channels: patch memory leaks, load addins from list
authorMarc-André Moreau <marcandre.moreau@gmail.com>
Mon, 19 Nov 2012 18:26:56 +0000 (13:26 -0500)
committerMarc-André Moreau <marcandre.moreau@gmail.com>
Mon, 19 Nov 2012 18:26:56 +0000 (13:26 -0500)
17 files changed:
channels/rail/client/rail_main.c
channels/rail/client/rail_main.h
channels/rdpsnd/client/rdpsnd_main.c
client/X11/xf_rail.c
client/common/cmdline.c
client/common/file.c
include/freerdp/client/file.h
include/freerdp/settings.h
libfreerdp/common/addin.c
libfreerdp/common/settings.c
libfreerdp/core/nla.c
libfreerdp/core/settings.c
libfreerdp/crypto/tls.c
libfreerdp/utils/svc_plugin.c
winpr/libwinpr/sspi/NTLM/ntlm.c
winpr/libwinpr/sspi/NTLM/ntlm_message.c
winpr/libwinpr/utils/cmdline.c

index fdfaffc..33ea3a9 100644 (file)
@@ -80,7 +80,7 @@ static void rail_process_connect(rdpSvcPlugin* plugin)
        railPlugin* rail = (railPlugin*) plugin;
 
        rail->rail_order = rail_order_new();
-       rail->rail_order->plugin_data = (RDP_PLUGIN_DATA*)plugin->channel_entry_points.pExtendedData;
+       rail->rail_order->settings = (rdpSettings*) plugin->channel_entry_points.pExtendedData;
        rail->rail_order->plugin = rail;
 }
 
@@ -96,11 +96,11 @@ static void rail_process_receive(rdpSvcPlugin* plugin, STREAM* s)
        stream_free(s);
 }
 
-static void rail_process_plugin_data(rdpRailOrder* rail_order, RDP_PLUGIN_DATA* data)
+static void rail_process_addin_args(rdpRailOrder* rail_order, rdpSettings* settings)
 {
        char* exeOrFile;
 
-       exeOrFile = (char*) data->data[0];
+       exeOrFile = settings->RemoteApplicationProgram;
 
        if (strlen(exeOrFile) >= 2)
        {
@@ -108,21 +108,20 @@ static void rail_process_plugin_data(rdpRailOrder* rail_order, RDP_PLUGIN_DATA*
                        rail_order->exec.flags |= RAIL_EXEC_FLAG_FILE;
        }
 
-       rail_string_to_unicode_string(rail_order, (char*) data->data[0], &rail_order->exec.exeOrFile);
-       rail_string_to_unicode_string(rail_order, (char*) data->data[1], &rail_order->exec.workingDir);
-       rail_string_to_unicode_string(rail_order, (char*) data->data[2], &rail_order->exec.arguments);
+       rail_string_to_unicode_string(rail_order, settings->RemoteApplicationProgram, &rail_order->exec.exeOrFile);
+       rail_string_to_unicode_string(rail_order, settings->ShellWorkingDirectory, &rail_order->exec.workingDir);
+       rail_string_to_unicode_string(rail_order, settings->RemoteApplicationCmdLine, &rail_order->exec.arguments);
 
        rail_send_client_exec_order(rail_order);
 }
 
 static void rail_recv_set_sysparams_event(rdpRailOrder* rail_order, RDP_EVENT* event)
 {
-       RDP_PLUGIN_DATA* data;
        RAIL_SYSPARAM_ORDER* sysparam;
 
        /* Send System Parameters */
 
-       sysparam = (RAIL_SYSPARAM_ORDER*)event->user_data;
+       sysparam = (RAIL_SYSPARAM_ORDER*) event->user_data;
        memmove(&rail_order->sysparam, sysparam, sizeof(RAIL_SYSPARAM_ORDER));
 
        rail_send_client_sysparams_order(rail_order);
@@ -131,19 +130,18 @@ static void rail_recv_set_sysparams_event(rdpRailOrder* rail_order, RDP_EVENT* e
 
        rail_order->exec.flags = RAIL_EXEC_FLAG_EXPAND_ARGUMENTS;
 
-       data = rail_order->plugin_data;
-       while (data && data->size > 0)
-       {
-               rail_process_plugin_data(rail_order, data);
-               data = (RDP_PLUGIN_DATA*)((char *)(data) + data->size);
-       }
+       rail_process_addin_args(rail_order, rail_order->settings);
 }
 
 static void rail_recv_exec_remote_app_event(rdpRailOrder* rail_order, RDP_EVENT* event)
 {
-       RDP_PLUGIN_DATA* data = (RDP_PLUGIN_DATA*) event->user_data;
+       /**
+        * TODO: replace event system by an API to allow the execution
+        * of multiple remote apps over the same connection. RAIL is
+        * always built-in, so clients can safely link to it.
+        */
 
-       rail_process_plugin_data(rail_order, data);
+       //rail_process_addin_args(rail_order, data);
 }
 
 static void rail_recv_activate_event(rdpRailOrder* rail_order, RDP_EVENT* event)
@@ -279,4 +277,3 @@ int VirtualChannelEntry(PCHANNEL_ENTRY_POINTS pEntryPoints)
 
        return 1;
 }
-
index ec9fc1f..8021899 100644 (file)
  * limitations under the License.
  */
 
-#ifndef __RAIL_MAIN_H
-#define        __RAIL_MAIN_H
+#ifndef FREERDP_CHANNEL_CLIENT_RAIL_MAIN_H
+#define FREERDP_CHANNEL_CLIENT_RAIL_MAIN_H
 
 #include <freerdp/rail.h>
+#include <freerdp/settings.h>
 #include <freerdp/utils/debug.h>
 #include <freerdp/utils/stream.h>
 #include <freerdp/utils/svc_plugin.h>
 
 struct rdp_rail_order
 {
-       RDP_PLUGIN_DATA* plugin_data;
+       rdpSettings* settings;
        void* plugin;
        RAIL_HANDSHAKE_ORDER handshake;
        RAIL_CLIENT_STATUS_ORDER client_status;
@@ -65,4 +66,4 @@ void rail_send_channel_data(void* rail_object, void* data, size_t length);
 #define DEBUG_RAIL(fmt, ...) DEBUG_NULL(fmt, ## __VA_ARGS__)
 #endif
 
-#endif /* __RAIL_MAIN_H */
+#endif /* FREERDP_CHANNEL_CLIENT_RAIL_MAIN_H */
index 0adb971..af1f217 100644 (file)
@@ -620,6 +620,12 @@ static void rdpsnd_process_terminate(rdpSvcPlugin* plugin)
        }
        list_free(rdpsnd->data_out_list);
 
+       if (rdpsnd->subsystem)
+               free(rdpsnd->subsystem);
+
+       if (rdpsnd->device_name)
+               free(rdpsnd->device_name);
+
        rdpsnd_free_supported_formats(rdpsnd);
 
        free(plugin);
index 636d2f9..a35aff5 100644 (file)
@@ -70,9 +70,9 @@ void xf_rail_paint(xfInfo* xfi, rdpRail* rail, INT32 uleft, INT32 utop, UINT32 u
                window = window_list_get_next(rail->list);
                xfw = (xfWindow*) window->extra;
 
-                // RDP can have zero width or height windows.  X cannot, so we ignore these.
+                /* RDP can have zero width or height windows. X cannot, so we ignore these. */
 
-                if (window->windowWidth == 0 || window->windowHeight == 0)
+                if ((window->windowWidth == 0) || (window->windowHeight == 0))
                 {
                         continue;
                 }
@@ -106,7 +106,6 @@ void xf_rail_DesktopNonMonitored(rdpRail *rail, rdpWindow* window)
        xf_rail_disable_remoteapp_mode(xfi);
 }
 
-
 static void xf_rail_CreateWindow(rdpRail* rail, rdpWindow* window)
 {
        xfInfo* xfi;
@@ -137,26 +136,28 @@ static void xf_rail_MoveWindow(rdpRail* rail, rdpWindow* window)
        xfi = (xfInfo*) rail->extra;
        xfw = (xfWindow*) window->extra;
 
-       //The rail server like to set the window to a small size when it is minimized even though it is hidden
-       //in some cases this can cause the window not to restore back to its original size. Therefore we dont update
-       //our local window when that rail window state is minimized
+       /*
+        * The rail server like to set the window to a small size when it is minimized even though it is hidden
+        * in some cases this can cause the window not to restore back to its original size. Therefore we don't
+        * update our local window when that rail window state is minimized
+        */
        if (xfw->rail_state == WINDOW_SHOW_MINIMIZED)
                return;
 
-       // Do nothing if window is already in the correct position      
+       /* Do nothing if window is already in the correct position */
         if ( xfw->left == window->visibleOffsetX && 
              xfw->top == window->visibleOffsetY &&  
              xfw->width == window->windowWidth &&
              xfw->height == window->windowHeight)
         {
-            //Just ensure entire window area is updated to
-            //handle cases where we have drawn locally before getting new bitmap
-            //from the server
+            /*
+             * Just ensure entire window area is updated to handle cases where we
+             * have drawn locally before getting new bitmap from the server
+             */
              xf_UpdateWindowArea(xfi, xfw, 0, 0, window->windowWidth, window->windowHeight);
              return;
         }
 
-
        xf_MoveWindow(xfi, xfw,
                window->visibleOffsetX, window->visibleOffsetY,
                window->windowWidth, window->windowHeight);
@@ -252,9 +253,10 @@ static void xf_on_free_rail_client_event(RDP_EVENT* event)
 static void xf_send_rail_client_event(rdpChannels* channels, UINT16 event_type, void* param)
 {
        RDP_EVENT* out_event = NULL;
-       void * payload = NULL;
+       void* payload = NULL;
 
        payload = rail_clone_order(event_type, param);
+
        if (payload != NULL)
        {
                out_event = freerdp_event_new(RDP_EVENT_CLASS_RAIL, event_type,
@@ -315,16 +317,17 @@ void xf_rail_adjust_position(xfInfo* xfi, rdpWindow *window)
        if (! xfw->is_mapped || xfw->local_move.state != LMS_NOT_ACTIVE)
                return;
 
-       // If current window position disagrees with RDP window position, send
-       // update to RDP server
+       /* If current window position disagrees with RDP window position, send update to RDP server */
        if ( xfw->left != window->visibleOffsetX ||
                xfw->top != window->visibleOffsetY ||
                 xfw->width != window->windowWidth ||
                 xfw->height != window->windowHeight)
         {
-              //Although the rail server can give negative window coordinates when updating windowOffsetX and windowOffsetY,
-              //we can only send unsigned integers to the rail server. Therefore, we always bring negative coordinates up to 0 when
-              //attempting to adjust the rail window.
+              /*
+               * Although the rail server can give negative window coordinates when updating windowOffsetX and windowOffsetY,
+               * we can only send unsigned integers to the rail server. Therefore, we always bring negative coordinates up to 0
+               * when attempting to adjust the rail window.
+               */
               UINT32 offsetX = 0;
                UINT32 offsetY = 0;
 
@@ -333,13 +336,18 @@ void xf_rail_adjust_position(xfInfo* xfi, rdpWindow *window)
 
                if (window->windowOffsetY < 0)
                        offsetY = offsetY - window->windowOffsetY;
-               //windowOffset corresponds to the window location on the rail server
-               //but our local window is based on the visibleOffset since using the windowOffset
-               //can result in blank areas for a maximized window
+
+               /*
+                * windowOffset corresponds to the window location on the rail server
+                * but our local window is based on the visibleOffset since using the windowOffset
+                * can result in blank areas for a maximized window
+                */
                window_move.windowId = window->windowId;
 
-               //Calculate new offsets for the rail server window
-               //Negative offset correction + rail server window offset + (difference in visibleOffset and new window local offset)
+               /*
+                * Calculate new offsets for the rail server window
+                * Negative offset correction + rail server window offset + (difference in visibleOffset and new window local offset)
+                */
                window_move.left = offsetX + window->windowOffsetX +  (xfw->left - window->visibleOffsetX);
                 window_move.top = offsetY + window->windowOffsetY + (xfw->top - window->visibleOffsetY);
                
@@ -379,9 +387,11 @@ void xf_rail_end_local_move(xfInfo* xfi, rdpWindow *window)
                xfw->left, xfw->top, xfw->right, xfw->bottom,
                xfw->width, xfw->height);
 
-       //Although the rail server can give negative window coordinates when updating windowOffsetX and windowOffsetY,
-       //we can only send unsigned integers to the rail server. Therefore, we always bring negative coordinates up to 0 when
-       //attempting to adjust the rail window.
+       /*
+        * Although the rail server can give negative window coordinates when updating windowOffsetX and windowOffsetY,
+        * we can only send unsigned integers to the rail server. Therefore, we always bring negative coordinates up to 0 when
+        * attempting to adjust the rail window.
+        */
        UINT32 offsetX = 0;
         UINT32 offsetY = 0;
 
@@ -396,15 +406,16 @@ void xf_rail_end_local_move(xfInfo* xfi, rdpWindow *window)
         */ 
        window_move.windowId = window->windowId;
 
-       //Calculate new offsets for the rail server window
-       //Negative offset correction + rail server window offset + (difference in visibleOffset and new window local offset)
+       /*
+        * Calculate new offsets for the rail server window
+        * Negative offset correction + rail server window offset + (difference in visibleOffset and new window local offset)
+        */
        window_move.left = offsetX + window->windowOffsetX +  (xfw->left - window->visibleOffsetX);
         window_move.top = offsetY + window->windowOffsetY + (xfw->top - window->visibleOffsetY);
        
-        window_move.right = window_move.left + xfw->width;   // In the update to RDP the position is one past the window
+        window_move.right = window_move.left + xfw->width; /* In the update to RDP the position is one past the window */
         window_move.bottom = window_move.top + xfw->height;
 
-
        xf_send_rail_client_event(channels, 
                RDP_EVENT_TYPE_RAIL_CLIENT_WINDOW_MOVE, &window_move);
        
@@ -417,7 +428,7 @@ void xf_rail_end_local_move(xfInfo* xfi, rdpWindow *window)
                &x, &y, &child_x, &child_y, &mask);
         input->MouseEvent(input, PTR_FLAGS_BUTTON1, x, y);
 
-       //only send the mouse coordinates if not a keyboard move or size
+       /* only send the mouse coordinates if not a keyboard move or size */
        if ((xfw->local_move.direction != _NET_WM_MOVERESIZE_MOVE_KEYBOARD) &&
             (xfw->local_move.direction != _NET_WM_MOVERESIZE_SIZE_KEYBOARD))
         {       
@@ -425,9 +436,11 @@ void xf_rail_end_local_move(xfInfo* xfi, rdpWindow *window)
                 DEBUG_X11_LMS("Mouse coordinates.  x= %i, y= %i", x, y);
         }
        
-       // Proactively update the RAIL window dimensions.  There is a race condition where
-       // we can start to receive GDI orders for the new window dimensions before we 
-       // receive the RAIL ORDER for the new window size.  This avoids that race condition.
+       /*
+        * Proactively update the RAIL window dimensions.  There is a race condition where
+        * we can start to receive GDI orders for the new window dimensions before we
+        * receive the RAIL ORDER for the new window size.  This avoids that race condition.
+        */
 
        window->windowOffsetX = offsetX + window->windowOffsetX +  (xfw->left - window->visibleOffsetX);
         window->windowOffsetY = offsetY + window->windowOffsetY + (xfw->top - window->visibleOffsetY);
@@ -545,12 +558,12 @@ const char* movetype_names[] =
 
 void xf_process_rail_server_localmovesize_event(xfInfo* xfi, rdpChannels* channels, RDP_EVENT* event)
 {
+       int x, y;
        rdpRail* rail;
-       rdpWindow* rail_window = NULL;
-       RAIL_LOCALMOVESIZE_ORDER* movesize = (RAIL_LOCALMOVESIZE_ORDER*) event->user_data;
        int direction = 0;
        Window child_window;
-       int x,y;
+       rdpWindow* rail_window = NULL;
+       RAIL_LOCALMOVESIZE_ORDER* movesize = (RAIL_LOCALMOVESIZE_ORDER*) event->user_data;
 
        rail = ((rdpContext*) xfi->context)->rail;
        rail_window = window_list_get_by_id(rail->list, movesize->windowId);
@@ -638,7 +651,7 @@ void xf_process_rail_server_localmovesize_event(xfInfo* xfi, rdpChannels* channe
 void xf_process_rail_appid_resp_event(xfInfo* xfi, rdpChannels* channels, RDP_EVENT* event)
 {
        RAIL_GET_APPID_RESP_ORDER* appid_resp =
-               (RAIL_GET_APPID_RESP_ORDER*)event->user_data;
+               (RAIL_GET_APPID_RESP_ORDER*) event->user_data;
 
        printf("Server Application ID Response PDU: windowId=0x%X "
                "applicationId=(length=%d dump)\n",
index ab04e06..34e42fd 100644 (file)
 
 COMMAND_LINE_ARGUMENT_A args[] =
 {
-       { "v", COMMAND_LINE_VALUE_REQUIRED, "<server>[:port]", NULL, NULL, -1, NULL, "destination server" },
-       { "port", COMMAND_LINE_VALUE_REQUIRED, "<number>", NULL, NULL, -1, NULL, "server port" },
-       { "w", COMMAND_LINE_VALUE_REQUIRED, "<width>", "1024", NULL, -1, NULL, "width" },
-       { "h", COMMAND_LINE_VALUE_REQUIRED, "<height>", "768", NULL, -1, NULL, "height" },
-       { "size", COMMAND_LINE_VALUE_REQUIRED, "<width>x<height>", "1024x768", NULL, -1, NULL, "screen size" },
-       { "f", COMMAND_LINE_VALUE_FLAG, NULL, NULL, NULL, -1, NULL, "fullscreen" },
-       { "bpp", COMMAND_LINE_VALUE_REQUIRED, "<depth>", "16", NULL, -1, NULL, "session bpp (color depth)" },
-       { "admin", COMMAND_LINE_VALUE_FLAG, NULL, NULL, NULL, -1, "console", "admin (or console) session" },
-       { "multimon", COMMAND_LINE_VALUE_FLAG, NULL, NULL, NULL, -1, NULL, "multi-monitor" },
-       { "workarea", COMMAND_LINE_VALUE_FLAG, NULL, NULL, NULL, -1, NULL, "work area" },
-       { "t", COMMAND_LINE_VALUE_REQUIRED, "<title>", NULL, NULL, -1, "title", "window title" },
-       { "decorations", COMMAND_LINE_VALUE_BOOL, NULL, NULL, BoolValueFalse, -1, NULL, "window decorations" },
-       { "a", COMMAND_LINE_VALUE_REQUIRED, NULL, NULL, NULL, -1, "addin", "addin" },
-       { "vc", COMMAND_LINE_VALUE_REQUIRED, NULL, NULL, NULL, -1, NULL, "static virtual channel" },
-       { "dvc", COMMAND_LINE_VALUE_REQUIRED, NULL, NULL, NULL, -1, NULL, "dynamic virtual channel" },
-       { "u", COMMAND_LINE_VALUE_REQUIRED, "[<domain>\\]<user>", NULL, NULL, -1, NULL, "username" },
-       { "p", COMMAND_LINE_VALUE_REQUIRED, "<password>", NULL, NULL, -1, NULL, "password" },
-       { "d", COMMAND_LINE_VALUE_REQUIRED, "<domain>", NULL, NULL, -1, NULL, "domain" },
-       { "g", COMMAND_LINE_VALUE_REQUIRED, "<gateway>[:port]", NULL, NULL, -1, NULL, "gateway" },
-       { "gu", COMMAND_LINE_VALUE_REQUIRED, "[<domain>\\]<user>", NULL, NULL, -1, NULL, "gateway username" },
-       { "gp", COMMAND_LINE_VALUE_REQUIRED, "<password>", NULL, NULL, -1, NULL, "gateway password" },
-       { "gd", COMMAND_LINE_VALUE_REQUIRED, "<domain>", NULL, NULL, -1, NULL, "gateway domain" },
-       { "z", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueFalse, NULL, -1, NULL, "compression" },
-       { "shell", COMMAND_LINE_VALUE_REQUIRED, NULL, NULL, NULL, -1, NULL, "alternate shell" },
-       { "shell-dir", COMMAND_LINE_VALUE_REQUIRED, NULL, NULL, NULL, -1, NULL, "shell working directory" },
-       { "audio", COMMAND_LINE_VALUE_REQUIRED, NULL, NULL, NULL, -1, NULL, "audio output mode" },
-       { "mic", COMMAND_LINE_VALUE_FLAG, NULL, NULL, NULL, -1, NULL, "audio input (microphone)" },
-       { "fonts", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueFalse, NULL, -1, NULL, "smooth fonts (cleartype)" },
-       { "aero", COMMAND_LINE_VALUE_BOOL, NULL, NULL, BoolValueFalse, -1, NULL, "desktop composition" },
-       { "window-drag", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueFalse, NULL, -1, NULL, "full window drag" },
-       { "menu-anims", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueFalse, NULL, -1, NULL, "menu animations" },
-       { "themes", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueTrue, NULL, -1, NULL, "themes" },
-       { "wallpaper", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueTrue, NULL, -1, NULL, "wallpaper" },
+       { "v", COMMAND_LINE_VALUE_REQUIRED, "<server>[:port]", NULL, NULL, -1, NULL, "Server hostname" },
+       { "port", COMMAND_LINE_VALUE_REQUIRED, "<number>", NULL, NULL, -1, NULL, "Server port" },
+       { "w", COMMAND_LINE_VALUE_REQUIRED, "<width>", "1024", NULL, -1, NULL, "Width" },
+       { "h", COMMAND_LINE_VALUE_REQUIRED, "<height>", "768", NULL, -1, NULL, "Height" },
+       { "size", COMMAND_LINE_VALUE_REQUIRED, "<width>x<height>", "1024x768", NULL, -1, NULL, "Screen size" },
+       { "f", COMMAND_LINE_VALUE_FLAG, NULL, NULL, NULL, -1, NULL, "Fullscreen mode" },
+       { "bpp", COMMAND_LINE_VALUE_REQUIRED, "<depth>", "16", NULL, -1, NULL, "Session bpp (color depth)" },
+       { "admin", COMMAND_LINE_VALUE_FLAG, NULL, NULL, NULL, -1, "console", "Admin (or console) session" },
+       { "multimon", COMMAND_LINE_VALUE_FLAG, NULL, NULL, NULL, -1, NULL, "Multi-monitor" },
+       { "workarea", COMMAND_LINE_VALUE_FLAG, NULL, NULL, NULL, -1, NULL, "Work area" },
+       { "t", COMMAND_LINE_VALUE_REQUIRED, "<title>", NULL, NULL, -1, "title", "Window title" },
+       { "decorations", COMMAND_LINE_VALUE_BOOL, NULL, NULL, BoolValueFalse, -1, NULL, "Window decorations" },
+       { "a", COMMAND_LINE_VALUE_REQUIRED, NULL, NULL, NULL, -1, "addin", "Addin" },
+       { "vc", COMMAND_LINE_VALUE_REQUIRED, NULL, NULL, NULL, -1, NULL, "Static virtual channel" },
+       { "dvc", COMMAND_LINE_VALUE_REQUIRED, NULL, NULL, NULL, -1, NULL, "Dynamic virtual channel" },
+       { "u", COMMAND_LINE_VALUE_REQUIRED, "[<domain>\\]<user>", NULL, NULL, -1, NULL, "Username" },
+       { "p", COMMAND_LINE_VALUE_REQUIRED, "<password>", NULL, NULL, -1, NULL, "Password" },
+       { "d", COMMAND_LINE_VALUE_REQUIRED, "<domain>", NULL, NULL, -1, NULL, "Domain" },
+       { "g", COMMAND_LINE_VALUE_REQUIRED, "<gateway>[:port]", NULL, NULL, -1, NULL, "Gateway Hostname" },
+       { "gu", COMMAND_LINE_VALUE_REQUIRED, "[<domain>\\]<user>", NULL, NULL, -1, NULL, "Gateway username" },
+       { "gp", COMMAND_LINE_VALUE_REQUIRED, "<password>", NULL, NULL, -1, NULL, "Gateway password" },
+       { "gd", COMMAND_LINE_VALUE_REQUIRED, "<domain>", NULL, NULL, -1, NULL, "Gateway domain" },
+       { "app", COMMAND_LINE_VALUE_REQUIRED, "||<alias> or <executable path>", NULL, NULL, -1, NULL, "Remote application program" },
+       { "app-name", COMMAND_LINE_VALUE_REQUIRED, "<app name>", NULL, NULL, -1, NULL, "Remote application name for user interface" },
+       { "app-icon", COMMAND_LINE_VALUE_REQUIRED, "<icon path>", NULL, NULL, -1, NULL, "Remote application icon for user interface" },
+       { "app-cmd", COMMAND_LINE_VALUE_REQUIRED, "<parameters>", NULL, NULL, -1, NULL, "Remote application command-line parameters" },
+       { "app-file", COMMAND_LINE_VALUE_REQUIRED, "<file name>", NULL, NULL, -1, NULL, "File to open with remote application" },
+       { "app-guid", COMMAND_LINE_VALUE_REQUIRED, "<app guid>", NULL, NULL, -1, NULL, "Remote application GUID" },
+       { "z", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueFalse, NULL, -1, NULL, "Compression" },
+       { "shell", COMMAND_LINE_VALUE_REQUIRED, NULL, NULL, NULL, -1, NULL, "Alternate shell" },
+       { "shell-dir", COMMAND_LINE_VALUE_REQUIRED, NULL, NULL, NULL, -1, NULL, "Shell working directory" },
+       { "audio", COMMAND_LINE_VALUE_REQUIRED, NULL, NULL, NULL, -1, NULL, "Audio output mode" },
+       { "mic", COMMAND_LINE_VALUE_FLAG, NULL, NULL, NULL, -1, NULL, "Audio input (microphone)" },
+       { "fonts", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueFalse, NULL, -1, NULL, "Smooth fonts (cleartype)" },
+       { "aero", COMMAND_LINE_VALUE_BOOL, NULL, NULL, BoolValueFalse, -1, NULL, "Desktop composition" },
+       { "window-drag", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueFalse, NULL, -1, NULL, "Full window drag" },
+       { "menu-anims", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueFalse, NULL, -1, NULL, "Menu animations" },
+       { "themes", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueTrue, NULL, -1, NULL, "Themes" },
+       { "wallpaper", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueTrue, NULL, -1, NULL, "Wallpaper" },
        { "gdi", COMMAND_LINE_VALUE_REQUIRED, "<sw|hw>", NULL, NULL, -1, NULL, "GDI rendering" },
        { "rfx", COMMAND_LINE_VALUE_FLAG, NULL, NULL, NULL, -1, NULL, "RemoteFX" },
        { "rfx-mode", COMMAND_LINE_VALUE_REQUIRED, "<image|video>", NULL, NULL, -1, NULL, "RemoteFX mode" },
@@ -305,17 +311,17 @@ int freerdp_client_add_device_channel(rdpSettings* settings, int count, char** p
 int freerdp_client_add_static_channel(rdpSettings* settings, int count, char** params)
 {
        int index;
-       ADDIN_ARGV* channel;
+       ADDIN_ARGV* args;
 
-       channel = (ADDIN_ARGV*) malloc(sizeof(ADDIN_ARGV));
+       args = (ADDIN_ARGV*) malloc(sizeof(ADDIN_ARGV));
 
-       channel->argc = count;
-       channel->argv = (char**) malloc(sizeof(char*) * channel->argc);
+       args->argc = count;
+       args->argv = (char**) malloc(sizeof(char*) * args->argc);
 
-       for (index = 0; index < channel->argc; index++)
-               channel->argv[index] = _strdup(params[index]);
+       for (index = 0; index < args->argc; index++)
+               args->argv[index] = _strdup(params[index]);
 
-       freerdp_static_channel_collection_add(settings, channel);
+       freerdp_static_channel_collection_add(settings, args);
 
        return 0;
 }
@@ -323,17 +329,17 @@ int freerdp_client_add_static_channel(rdpSettings* settings, int count, char** p
 int freerdp_client_add_dynamic_channel(rdpSettings* settings, int count, char** params)
 {
        int index;
-       ADDIN_ARGV* channel;
+       ADDIN_ARGV* args;
 
-       channel = (ADDIN_ARGV*) malloc(sizeof(ADDIN_ARGV));
+       args = (ADDIN_ARGV*) malloc(sizeof(ADDIN_ARGV));
 
-       channel->argc = count;
-       channel->argv = (char**) malloc(sizeof(char*) * channel->argc);
+       args->argc = count;
+       args->argv = (char**) malloc(sizeof(char*) * args->argc);
 
-       for (index = 0; index < channel->argc; index++)
-               channel->argv[index] = _strdup(params[index]);
+       for (index = 0; index < args->argc; index++)
+               args->argv[index] = _strdup(params[index]);
 
-       freerdp_dynamic_channel_collection_add(settings, channel);
+       freerdp_dynamic_channel_collection_add(settings, args);
 
        return 0;
 }
@@ -402,8 +408,6 @@ int freerdp_client_command_line_post_filter(void* context, COMMAND_LINE_ARGUMENT
 
                p = freerdp_command_line_parse_comma_separated_values(arg->Value, &count);
 
-               printf("addin: %s %s %s\n", p[0], p[1], p[2]);
-
                freerdp_client_add_static_channel(settings, count, p);
 
                free(p);
@@ -416,8 +420,6 @@ int freerdp_client_command_line_post_filter(void* context, COMMAND_LINE_ARGUMENT
 
                p = freerdp_command_line_parse_comma_separated_values(arg->Value, &count);
 
-               printf("addin: %s %s %s\n", p[0], p[1], p[2]);
-
                freerdp_client_add_dynamic_channel(settings, count, p);
 
                free(p);
@@ -608,6 +610,36 @@ int freerdp_client_parse_command_line_arguments(int argc, char** argv, rdpSettin
                        settings->GatewayPassword = _strdup(arg->Value);
                        settings->GatewayUseSameCredentials = FALSE;
                }
+               CommandLineSwitchCase(arg, "app")
+               {
+                       settings->RemoteApplicationProgram = _strdup(arg->Value);
+
+                       settings->RemoteApplicationMode = TRUE;
+                       settings->RemoteAppLanguageBarSupported = TRUE;
+                       settings->Workarea = TRUE;
+                       settings->DisableWallpaper = TRUE;
+                       settings->DisableFullWindowDrag = TRUE;
+               }
+               CommandLineSwitchCase(arg, "app-name")
+               {
+                       settings->RemoteApplicationName = _strdup(arg->Value);
+               }
+               CommandLineSwitchCase(arg, "app-icon")
+               {
+                       settings->RemoteApplicationIcon = _strdup(arg->Value);
+               }
+               CommandLineSwitchCase(arg, "app-cmd")
+               {
+                       settings->RemoteApplicationCmdLine = _strdup(arg->Value);
+               }
+               CommandLineSwitchCase(arg, "app-file")
+               {
+                       settings->RemoteApplicationFile = _strdup(arg->Value);
+               }
+               CommandLineSwitchCase(arg, "app-guid")
+               {
+                       settings->RemoteApplicationGuid = _strdup(arg->Value);
+               }
                CommandLineSwitchCase(arg, "z")
                {
                        settings->CompressionEnabled = arg->Value ? TRUE : FALSE;
@@ -799,6 +831,21 @@ int freerdp_client_load_addins(rdpChannels* channels, rdpSettings* settings)
        int index;
        void* entry = NULL;
 
+       for (index = 0; index < settings->StaticChannelCount; index++)
+       {
+               ADDIN_ARGV* args;
+
+               args = settings->StaticChannelArray[index];
+
+               entry = freerdp_load_channel_addin_entry(args->argv[0], NULL, NULL, FREERDP_ADDIN_CHANNEL_STATIC);
+
+               if (entry)
+               {
+                       if (freerdp_channels_client_load(channels, settings, entry, args) == 0)
+                               printf("loading channel %s\n", args->argv[0]);
+               }
+       }
+
        if (settings->DeviceRedirection)
        {
                entry = freerdp_load_channel_addin_entry("rdpdr", NULL, NULL, FREERDP_ADDIN_CHANNEL_STATIC);
@@ -810,18 +857,14 @@ int freerdp_client_load_addins(rdpChannels* channels, rdpSettings* settings)
                }
        }
 
-       for (index = 0; index < settings->StaticChannelCount; index++)
+       if (settings->RemoteApplicationMode)
        {
-               ADDIN_ARGV* args;
-
-               args = settings->StaticChannelArray[index];
-
-               entry = freerdp_load_channel_addin_entry(args->argv[0], NULL, NULL, FREERDP_ADDIN_CHANNEL_STATIC);
+               entry = freerdp_load_channel_addin_entry("rail", NULL, NULL, FREERDP_ADDIN_CHANNEL_STATIC);
 
                if (entry)
                {
-                       if (freerdp_channels_client_load(channels, settings, entry, args) == 0)
-                               printf("loading channel %s\n", args->argv[0]);
+                       if (freerdp_channels_client_load(channels, settings, entry, settings) == 0)
+                               printf("loading channel %s\n", "rail");
                }
        }
 
index a9e83d3..237396d 100644 (file)
@@ -244,6 +244,8 @@ BOOL freerdp_client_rdp_file_set_string(rdpFile* file, char* name, char* value)
                file->RemoteApplicationProgram = value;
        else if (_stricmp(name, "remoteapplicationfile") == 0)
                file->RemoteApplicationFile = value;
+       else if (_stricmp(name, "remoteapplicationguid") == 0)
+               file->RemoteApplicationGuid = value;
        else if (_stricmp(name, "remoteapplicationcmdline") == 0)
                file->RemoteApplicationCmdLine = value;
        else if (_stricmp(name, "alternate shell") == 0)
@@ -537,6 +539,18 @@ BOOL freerdp_client_populate_settings_from_rdp_file(rdpFile* file, rdpSettings*
        
        if (~file->RemoteApplicationMode)
                settings->RemoteApplicationMode = file->RemoteApplicationMode;
+       if (~((size_t) file->RemoteApplicationProgram))
+               settings->RemoteApplicationProgram = file->RemoteApplicationProgram;
+       if (~((size_t) file->RemoteApplicationName))
+               settings->RemoteApplicationName = file->RemoteApplicationName;
+       if (~((size_t) file->RemoteApplicationIcon))
+               settings->RemoteApplicationIcon = file->RemoteApplicationIcon;
+       if (~((size_t) file->RemoteApplicationFile))
+               settings->RemoteApplicationFile = file->RemoteApplicationFile;
+       if (~((size_t) file->RemoteApplicationGuid))
+               settings->RemoteApplicationGuid = file->RemoteApplicationGuid;
+       if (~((size_t) file->RemoteApplicationCmdLine))
+               settings->RemoteApplicationCmdLine = file->RemoteApplicationCmdLine;
 
        return TRUE;
 }
index c7f2525..1607a38 100644 (file)
@@ -106,6 +106,7 @@ struct rdp_file
        LPSTR RemoteApplicationIcon; /* remoteapplicationicon */
        LPSTR RemoteApplicationProgram; /* remoteapplicationprogram */
        LPSTR RemoteApplicationFile; /* remoteapplicationfile */
+       LPSTR RemoteApplicationGuid; /* remoteapplicationguid */
        LPSTR RemoteApplicationCmdLine; /* remoteapplicationcmdline */
        DWORD RemoteApplicationExpandCmdLine; /* remoteapplicationexpandcmdline */
        DWORD RemoteApplicationExpandWorkingDir; /* remoteapplicationexpandworkingdir */
index 6d1061f..778bde0 100644 (file)
@@ -725,14 +725,15 @@ struct rdp_settings
        ALIGN64 char* RemoteApplicationIcon; /* 2114 */
        ALIGN64 char* RemoteApplicationProgram; /* 2115 */
        ALIGN64 char* RemoteApplicationFile; /* 2116 */
-       ALIGN64 char* RemoteApplicationCmdLine; /* 2117 */
-       ALIGN64 DWORD RemoteApplicationExpandCmdLine; /* 2118 */
-       ALIGN64 DWORD RemoteApplicationExpandWorkingDir; /* 2119 */
-       ALIGN64 DWORD DisableRemoteAppCapsCheck; /* 2120 */
-       ALIGN64 UINT32 RemoteAppNumIconCaches; /* 2121 */
-       ALIGN64 UINT32 RemoteAppNumIconCacheEntries; /* 2122 */
-       ALIGN64 BOOL RemoteAppLanguageBarSupported; /* 2123 */
-       UINT64 padding2176[2176 - 2124]; /* 2124 */
+       ALIGN64 char* RemoteApplicationGuid; /* 2117 */
+       ALIGN64 char* RemoteApplicationCmdLine; /* 2118 */
+       ALIGN64 DWORD RemoteApplicationExpandCmdLine; /* 2119 */
+       ALIGN64 DWORD RemoteApplicationExpandWorkingDir; /* 2120 */
+       ALIGN64 DWORD DisableRemoteAppCapsCheck; /* 2121 */
+       ALIGN64 UINT32 RemoteAppNumIconCaches; /* 2122 */
+       ALIGN64 UINT32 RemoteAppNumIconCacheEntries; /* 2123 */
+       ALIGN64 BOOL RemoteAppLanguageBarSupported; /* 2124 */
+       UINT64 padding2176[2176 - 2125]; /* 2125 */
        UINT64 padding2240[2240 - 2124]; /* 2176 */
 
        /**
@@ -959,7 +960,12 @@ FREERDP_API rdpSettings* freerdp_settings_new(void* instance);
 FREERDP_API void freerdp_settings_free(rdpSettings* settings);
 
 FREERDP_API void freerdp_device_collection_add(rdpSettings* settings, RDPDR_DEVICE* device);
+FREERDP_API void freerdp_device_collection_free(rdpSettings* settings);
+
 FREERDP_API void freerdp_static_channel_collection_add(rdpSettings* settings, ADDIN_ARGV* channel);
+FREERDP_API void freerdp_static_channel_collection_free(rdpSettings* settings);
+
 FREERDP_API void freerdp_dynamic_channel_collection_add(rdpSettings* settings, ADDIN_ARGV* channel);
+FREERDP_API void freerdp_dynamic_channel_collection_free(rdpSettings* settings);
 
 #endif /* FREERDP_SETTINGS_H */
index 73b26f7..a8a8c93 100644 (file)
@@ -193,6 +193,9 @@ void* freerdp_load_dynamic_channel_addin_entry(LPCSTR pszName, LPSTR pszSubsyste
 
                entry = freerdp_load_dynamic_addin(pszFileName, NULL, pszEntryName);
 
+               free(pszEntryName);
+               free(pszFileName);
+
                if (entry)
                        return entry;
        }
@@ -209,6 +212,8 @@ void* freerdp_load_dynamic_channel_addin_entry(LPCSTR pszName, LPSTR pszSubsyste
                else
                        entry = freerdp_load_dynamic_addin(pszFileName, NULL, pszType);
 
+               free(pszFileName);
+
                if (entry)
                        return entry;
        }
index adc6ea4..a6df609 100644 (file)
@@ -38,6 +38,48 @@ void freerdp_device_collection_add(rdpSettings* settings, RDPDR_DEVICE* device)
        settings->DeviceArray[settings->DeviceCount++] = device;
 }
 
+void freerdp_device_collection_free(rdpSettings* settings)
+{
+       int index;
+       RDPDR_DEVICE* device;
+
+       for (index = 0; index < settings->DeviceCount; index++)
+       {
+               device = (RDPDR_DEVICE*) settings->DeviceArray[index];
+
+               free(device->Name);
+
+               if (settings->DeviceArray[index]->Type == RDPDR_DTYP_FILESYSTEM)
+               {
+                       free(((RDPDR_DRIVE*) device)->Path);
+               }
+               else if (settings->DeviceArray[index]->Type == RDPDR_DTYP_PRINT)
+               {
+
+               }
+               else if (settings->DeviceArray[index]->Type == RDPDR_DTYP_SMARTCARD)
+               {
+                       free(((RDPDR_SMARTCARD*) device)->Path);
+               }
+               else if (settings->DeviceArray[index]->Type == RDPDR_DTYP_SERIAL)
+               {
+                       free(((RDPDR_SERIAL*) device)->Path);
+               }
+               else if (settings->DeviceArray[index]->Type == RDPDR_DTYP_PARALLEL)
+               {
+                       free(((RDPDR_PARALLEL*) device)->Path);
+               }
+
+               free(device);
+       }
+
+       free(settings->DeviceArray);
+
+       settings->DeviceArraySize = 0;
+       settings->DeviceArray = NULL;
+       settings->DeviceCount = 0;
+}
+
 void freerdp_static_channel_collection_add(rdpSettings* settings, ADDIN_ARGV* channel)
 {
        if (settings->StaticChannelArraySize < (settings->StaticChannelCount + 1))
@@ -50,6 +92,22 @@ void freerdp_static_channel_collection_add(rdpSettings* settings, ADDIN_ARGV* ch
        settings->StaticChannelArray[settings->StaticChannelCount++] = channel;
 }
 
+void freerdp_static_channel_collection_free(rdpSettings* settings)
+{
+       int index;
+
+       for (index = 0; index < settings->StaticChannelCount; index++)
+       {
+               free(settings->StaticChannelArray[index]);
+       }
+
+       free(settings->StaticChannelArray);
+
+       settings->StaticChannelArraySize = 0;
+       settings->StaticChannelArray = NULL;
+       settings->StaticChannelCount = 0;
+}
+
 void freerdp_dynamic_channel_collection_add(rdpSettings* settings, ADDIN_ARGV* channel)
 {
        if (settings->DynamicChannelArraySize < (settings->DynamicChannelCount + 1))
@@ -61,3 +119,19 @@ void freerdp_dynamic_channel_collection_add(rdpSettings* settings, ADDIN_ARGV* c
 
        settings->DynamicChannelArray[settings->DynamicChannelCount++] = channel;
 }
+
+void freerdp_dynamic_channel_collection_free(rdpSettings* settings)
+{
+       int index;
+
+       for (index = 0; index < settings->DynamicChannelCount; index++)
+       {
+               free(settings->DynamicChannelArray[index]);
+       }
+
+       free(settings->DynamicChannelArray);
+
+       settings->DynamicChannelArraySize = 0;
+       settings->DynamicChannelArray = NULL;
+       settings->DynamicChannelCount = 0;
+}
index a0732aa..d94409b 100644 (file)
@@ -1299,6 +1299,8 @@ void credssp_free(rdpCredssp* credssp)
                sspi_SecBufferFree(&credssp->PublicKey);
                sspi_SecBufferFree(&credssp->ts_credentials);
 
+               free(credssp->ServicePrincipalName);
+
                free(credssp->identity.User);
                free(credssp->identity.Domain);
                free(credssp->identity.Password);
index 450e0a5..92fba82 100644 (file)
@@ -452,9 +452,9 @@ void freerdp_settings_free(rdpSettings* settings)
                key_free(settings->RdpServerRsaKey);
                free(settings->ConfigPath);
                free(settings->CurrentPath);
-               free(settings->DeviceArray);
-               free(settings->StaticChannelArray);
-               free(settings->DynamicChannelArray);
+               freerdp_device_collection_free(settings);
+               freerdp_static_channel_collection_free(settings);
+               freerdp_dynamic_channel_collection_free(settings);
                free(settings);
        }
 }
index 27123c4..5316af1 100644 (file)
@@ -561,6 +561,8 @@ BOOL tls_verify_certificate(rdpTls* tls, CryptoCert cert, char* hostname)
                free(certificate_data);
        }
 
+       free(common_name);
+
        return verification_status;
 }
 
index 0c309d4..0dd70b4 100644 (file)
@@ -26,6 +26,8 @@
 #include <stdlib.h>
 #include <string.h>
 
+#include <winpr/crt.h>
+
 #include <freerdp/constants.h>
 #include <freerdp/utils/memory.h>
 #include <freerdp/utils/debug.h>
@@ -64,11 +66,13 @@ static void svc_data_in_item_free(svc_data_in_item* item)
                stream_free(item->data_in);
                item->data_in = NULL;
        }
+
        if (item->event_in)
        {
                freerdp_event_free(item->event_in);
                item->event_in = NULL;
        }
+
        free(item);
 }
 
@@ -107,8 +111,8 @@ static rdpSvcPlugin* svc_plugin_find_by_init_handle(void* init_handle)
 
 static rdpSvcPlugin* svc_plugin_find_by_open_handle(UINT32 open_handle)
 {
-       rdpSvcPluginList * list;
-       rdpSvcPlugin * plugin;
+       rdpSvcPluginList* list;
+       rdpSvcPlugin* plugin;
 
        WaitForSingleObject(g_mutex, INFINITE);
 
@@ -122,6 +126,7 @@ static rdpSvcPlugin* svc_plugin_find_by_open_handle(UINT32 open_handle)
                        return plugin;
                }
        }
+
        ReleaseMutex(g_mutex);
 
        return NULL;
@@ -134,11 +139,13 @@ static void svc_plugin_remove(rdpSvcPlugin* plugin)
 
        /* Remove from global list */
        WaitForSingleObject(g_mutex, INFINITE);
+
        for (prev = NULL, list = g_svc_plugin_list; list; prev = list, list = list->next)
        {
                if (list->plugin == plugin)
                        break;
        }
+
        if (list)
        {
                if (prev)
@@ -147,6 +154,7 @@ static void svc_plugin_remove(rdpSvcPlugin* plugin)
                        g_svc_plugin_list = list->next;
                free(list);
        }
+
        ReleaseMutex(g_mutex);
 }
 
@@ -201,7 +209,8 @@ static void svc_plugin_process_event(rdpSvcPlugin* plugin, RDP_EVENT* event_in)
 {
        svc_data_in_item* item;
 
-       item = xnew(svc_data_in_item);
+       item = (svc_data_in_item*) malloc(sizeof(svc_data_in_item));
+       ZeroMemory(item, sizeof(svc_data_in_item));
        item->event_in = event_in;
 
        freerdp_thread_lock(plugin->priv->thread);
@@ -273,7 +282,7 @@ static void svc_plugin_process_data_in(rdpSvcPlugin* plugin)
 
 static void* svc_plugin_thread_func(void* arg)
 {
-       rdpSvcPlugin* plugin = (rdpSvcPlugin*)arg;
+       rdpSvcPlugin* plugin = (rdpSvcPlugin*) arg;
 
        DEBUG_SVC("in");
 
@@ -330,7 +339,6 @@ static void svc_plugin_process_terminated(rdpSvcPlugin* plugin)
        freerdp_thread_free(plugin->priv->thread);
 
        plugin->channel_entry_points.pVirtualChannelClose(plugin->priv->open_handle);
-       //free(plugin->channel_entry_points.pExtendedData);
 
        svc_plugin_remove(plugin);
 
@@ -391,10 +399,12 @@ void svc_plugin_init(rdpSvcPlugin* plugin, CHANNEL_ENTRY_POINTS* pEntryPoints)
 
        memcpy(&plugin->channel_entry_points, pEntryPoints, pEntryPoints->cbSize);
 
-       plugin->priv = xnew(rdpSvcPluginPrivate);
+       plugin->priv = (rdpSvcPluginPrivate*) malloc(sizeof(rdpSvcPluginPrivate));
+       ZeroMemory(plugin->priv, sizeof(rdpSvcPluginPrivate));
 
        /* Add it to the global list */
-       list = xnew(rdpSvcPluginList);
+       list = (rdpSvcPluginList*) malloc(sizeof(rdpSvcPluginList));
+       ZeroMemory(list, sizeof(rdpSvcPluginList));
        list->plugin = plugin;
 
        WaitForSingleObject(g_mutex, INFINITE);
@@ -440,4 +450,3 @@ int svc_plugin_send_event(rdpSvcPlugin* plugin, RDP_EVENT* event)
 
        return error;
 }
-
index f408daf..d9a3aca 100644 (file)
@@ -173,6 +173,8 @@ void ntlm_ContextFree(NTLM_CONTEXT* context)
        sspi_SecBufferFree(&context->NtChallengeResponse);
        sspi_SecBufferFree(&context->LmChallengeResponse);
 
+       free(context->ServicePrincipalName.Buffer);
+
        free(context->identity.User);
        free(context->identity.Password);
        free(context->identity.Domain);
index 4eff966..8fb0ec0 100644 (file)
@@ -430,6 +430,7 @@ SECURITY_STATUS ntlm_read_ChallengeMessage(NTLM_CONTEXT* context, PSecBuffer buf
        if (context->NTLMv2)
        {
                ntlm_construct_authenticate_target_info(context);
+               sspi_SecBufferFree(&context->ChallengeTargetInfo);
                context->ChallengeTargetInfo.pvBuffer = context->AuthenticateTargetInfo.pvBuffer;
                context->ChallengeTargetInfo.cbBuffer = context->AuthenticateTargetInfo.cbBuffer;
        }
@@ -514,6 +515,8 @@ SECURITY_STATUS ntlm_read_ChallengeMessage(NTLM_CONTEXT* context, PSecBuffer buf
 
        context->state = NTLM_STATE_AUTHENTICATE;
 
+       ntlm_free_message_fields_buffer(&(message.TargetName));
+
        PStreamFreeDetach(s);
 
        return SEC_I_CONTINUE_NEEDED;
index 77691be..21df28c 100644 (file)
@@ -102,6 +102,9 @@ int CommandLineParseArgumentsA(int argc, LPCSTR* argv, COMMAND_LINE_ARGUMENT_A*
        int value_length;
        int value_index;
 
+       if (!argv)
+               return 0;
+
        for (i = 1; i < argc; i++)
        {
                if (preFilter)