summaryrefslogtreecommitdiff
blob: dfd211e99814bd8d13fee5b6a5e339db4d64e97e (plain)
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
diff -u amsn-0.95_OLD/config.tcl amsn-0.95/config.tcl
--- amsn-0.95_OLD/config.tcl	2005-12-22 03:06:24.000000000 +0100
+++ amsn-0.95/config.tcl	2007-04-23 19:37:54.000000000 +0200
@@ -1324,7 +1324,12 @@
 	while { $tries < 5 } {
 		set Port [GetRandomProfilePort]
 		status_log "LockProfile: Got random port $Port\n" blue
-		if { [catch {socket -server lockSvrNew -myaddr localhost $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  } {
 			# Got one
 			LoginList changelock 0 $email $Port
 			set lockSock $newlockSock
diff -u amsn-0.95_OLD/remote.tcl amsn-0.95/remote.tcl
--- amsn-0.95_OLD/remote.tcl	2005-12-22 03:06:24.000000000 +0100
+++ amsn-0.95/remote.tcl	2007-04-23 19:40:41.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 
@@ -235,6 +241,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
@@ -247,6 +258,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] } {
@@ -264,26 +278,27 @@
 }
 
 proc authenticate { command sock } {
-	global remotemd5key remote_auth remote_sock_lock
+	global remotemd5key remote_auth remote_sock_lock remote_authtimer 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
-				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 {