mirror of
https://github.com/bolkedebruin/rdpgw.git
synced 2026-03-27 14:36:36 +00:00
Fix parsing of bool to int
This commit is contained in:
@@ -44,6 +44,7 @@ func (p *RDP) Unmarshal(b []byte) (map[string]interface{}, error) {
|
||||
}
|
||||
mp[key] = intValue
|
||||
case "s":
|
||||
case "b":
|
||||
mp[key] = val
|
||||
default:
|
||||
return nil, fmt.Errorf("malformed line %d: %s", c, line)
|
||||
|
||||
@@ -28,12 +28,12 @@ const (
|
||||
)
|
||||
|
||||
type RdpSettings struct {
|
||||
AllowFontSmoothing string `rdp:"allow font smoothing" default:"0"`
|
||||
AllowDesktopComposition string `rdp:"allow desktop composition" default:"0"`
|
||||
DisableFullWindowDrag string `rdp:"disable full window drag" default:"0"`
|
||||
DisableMenuAnims string `rdp:"disable menu anims" default:"0"`
|
||||
DisableThemes string `rdp:"disable themes" default:"0"`
|
||||
DisableCursorSetting string `rdp:"disable cursor setting" default:"0"`
|
||||
AllowFontSmoothing bool `rdp:"allow font smoothing" default:"0"`
|
||||
AllowDesktopComposition bool `rdp:"allow desktop composition" default:"0"`
|
||||
DisableFullWindowDrag bool `rdp:"disable full window drag" default:"0"`
|
||||
DisableMenuAnims bool `rdp:"disable menu anims" default:"0"`
|
||||
DisableThemes bool `rdp:"disable themes" default:"0"`
|
||||
DisableCursorSetting bool `rdp:"disable cursor setting" default:"0"`
|
||||
GatewayHostname string `rdp:"gatewayhostname"`
|
||||
FullAddress string `rdp:"full address"`
|
||||
AlternateFullAddress string `rdp:"alternate full address"`
|
||||
@@ -114,8 +114,9 @@ func NewBuilderFromFile(filename string) (*Builder, error) {
|
||||
metadata := mapstructure.Metadata{}
|
||||
|
||||
decoderConfig := &mapstructure.DecoderConfig{
|
||||
Result: &c,
|
||||
Metadata: &metadata,
|
||||
Result: &c,
|
||||
Metadata: &metadata,
|
||||
WeaklyTypedInput: true,
|
||||
}
|
||||
|
||||
var k = koanf.New(".")
|
||||
|
||||
@@ -38,3 +38,10 @@ func TestInitStruct(t *testing.T) {
|
||||
t.Fatalf("conn.PromptCredentialsOnce != true")
|
||||
}
|
||||
}
|
||||
|
||||
func TestLoadFile(t *testing.T) {
|
||||
_, err := NewBuilderFromFile("rdp_test_file.rdp")
|
||||
if err != nil {
|
||||
t.Fatalf("LoadFile failed: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
37
cmd/rdpgw/rdp/rdp_test_file.rdp
Normal file
37
cmd/rdpgw/rdp/rdp_test_file.rdp
Normal file
@@ -0,0 +1,37 @@
|
||||
Password:b:0200000000000000000000000000000000000000000000000800000072006400700000000E660000100000001000000031A2D4A21767565E3A268420A9397C4400000000048000001000000010000000A56C359BBBA13EC284391427E6A107BD20000000333E6F6DA024E1B6B4CC7DDF57BFC1783ED02F212B8FBD39997C888F9D4B438914000000A80D19234BA4CC5CE2695A34EF0B9B92D5D777A6
|
||||
ColorDepthID:i:1
|
||||
ScreenStyle:i:0
|
||||
DesktopWidth:i:640
|
||||
DesktopHeight:i:480
|
||||
UserName:s:rdesktop
|
||||
SavePassword:i:1
|
||||
Keyboard Layout:s:00000409
|
||||
BitmapPersistCacheSize:i:1
|
||||
BitmapCacheSize:i:21
|
||||
KeyboardFunctionKey:i:12
|
||||
KeyboardSubType:i:0
|
||||
KeyboardType:i:4
|
||||
KeyboardLayoutString:s:0xE0010409
|
||||
Disable Themes:i:0
|
||||
Disable Menu Anims:i:1
|
||||
Disable Full Window Drag:i:1
|
||||
Disable Wallpaper:i:1
|
||||
MaxReconnectAttempts:i:20
|
||||
KeyboardHookMode:i:0
|
||||
Compress:i:1
|
||||
BBarShowPinBtn:i:0
|
||||
BitmapPersistenceEnabled:i:0
|
||||
AudioRedirectionMode:i:2
|
||||
EnablePortRedirection:i:0
|
||||
EnableDriveRedirection:i:0
|
||||
AutoReconnectEnabled:i:1
|
||||
EnableSCardRedirection:i:1
|
||||
EnablePrinterRedirection:i:0
|
||||
BBarEnabled:i:0
|
||||
DisableFileAccess:i:0
|
||||
MinutesToIdleTimeout:i:5
|
||||
GrabFocusOnConnect:i:0
|
||||
StartFullScreen:i:1
|
||||
Domain:s:GE3SDT8KLRL4J
|
||||
enablecredsspsupport:i:0
|
||||
use multimon:i:1
|
||||
Reference in New Issue
Block a user