1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
|
diff -u amsn-0.96_OLD/config.tcl amsn-0.96/config.tcl
--- amsn-0.96_OLD/config.tcl 2006-09-06 19:08:18.000000000 +0200
+++ amsn-0.96/config.tcl 2007-04-23 19:43:12.000000000 +0200
@@ -1357,7 +1357,12 @@
while { $tries < 5 } {
set Port [GetRandomProfilePort]
status_log "LockProfile: Got random port $Port\n" blue
- if { [catch {socket -server lockSvrNew $Port} newlockSock] == 0 } {
+ if { [::config::getKey enableremote] == 1} {
+ set cmd "socket -server lockSvrNew $Port"
+ } else {
+ set cmd "socket -myaddr 127.0.0.1 -server lockSvrNew $Port"
+ }
+ if { [catch {eval $cmd} newlockSock] == 0 } {
LoginList changelock 0 $email $Port
set lockSock $newlockSock
break
diff -u amsn-0.96_OLD/remote.tcl amsn-0.96/remote.tcl
--- amsn-0.96_OLD/remote.tcl 2006-10-08 05:13:58.000000000 +0200
+++ amsn-0.96/remote.tcl 2007-04-23 19:50:30.000000000 +0200
@@ -9,6 +9,7 @@
set remote_auth 0
set remote_sock_lock 0
set remote_sock 0
+ set remote_authtimer 0
}
proc remote_check_online { } {
@@ -20,6 +21,11 @@
}
}
+proc remote_touchauthtimer {} {
+ global remote_authtimer
+ set remote_authtimer 0
+}
+
namespace eval ::remote {
# connect
@@ -240,6 +246,11 @@
proc read_remote { command sock } {
global remote_auth remote_sock
+ if { [::config::getKey enableremote] != 1} {
+ close $sock
+ return
+ }
+
if { "$remote_sock" != "$sock" } {
set remote_temp_sock $remote_sock
init_remote $sock
@@ -252,6 +263,9 @@
if {$command != ""} {
+ #AIM-FIX: Make command a real quoted list, or it will raise
+ #errors when containing braces
+ set command [split $command]
if { $remote_auth == 0 } {
authenticate "$command" "$sock"
} elseif { [catch {eval "::remote::$command" } res] } {
@@ -269,28 +283,28 @@
}
proc authenticate { command sock } {
- global remotemd5key remote_auth remote_sock_lock
+ global remotemd5key remote_auth remote_sock_lock remote_authtimer
global userchatto
+ if {$remote_authtimer} {
+ close $sock
+ return
+ }
+
if { $command == "auth" } {
set remotemd5key "[md5keygen]"
write_remote "auth $remotemd5key"
} elseif { [lindex $command 0] == "auth2" && [info exists remotemd5key] } {
if { "[lindex $command 1]" == "[::md5::hmac $remotemd5key [list [::config::getKey remotepassword]]]" } {
- if { [::config::getKey enableremote] == 1 } {
- set remote_auth 1
- set remote_sock_lock $sock
- catch { unset userchatto }
- write_remote "Authentication successfull"
- } else {
- write_remote "User disabled remote control"
- }
+ set remote_auth 1
+ set remote_sock_lock $sock
+ catch { unset userchatto }
+ write_remote "Authentication successfull"
} else {
- if { [::config::getKey enableremote] == 1 } {
- write_remote "Authentication failed"
- } else {
- write_remote "User disabled remote control"
- }
+ set remote_authtimer 1
+ after 3000 [list remote_touchauthtimer]
+ vwait remote_authtimer
+ write_remote "Authentication failed"
}
unset remotemd5key
} else {
|