Sfoglia il codice sorgente

Merge pull request #228 from slingamn/issue227

fix #227
tags/v0.11.0-beta
Daniel Oaks 6 anni fa
parent
commit
f1af7a2e2a
Nessun account collegato all'indirizzo email del committer
1 ha cambiato i file con 11 aggiunte e 6 eliminazioni
  1. 11
    6
      irc/nickserv.go

+ 11
- 6
irc/nickserv.go Vedi File

193
 func nsGhostHandler(server *Server, client *Client, command, params string, rb *ResponseBuffer) {
193
 func nsGhostHandler(server *Server, client *Client, command, params string, rb *ResponseBuffer) {
194
 	nick, _ := utils.ExtractParam(params)
194
 	nick, _ := utils.ExtractParam(params)
195
 
195
 
196
-	account := client.Account()
197
-	if account == "" || server.accounts.NickToAccount(nick) != account {
198
-		nsNotice(rb, client.t("You don't own that nick"))
199
-		return
200
-	}
201
-
202
 	ghost := server.clients.Get(nick)
196
 	ghost := server.clients.Get(nick)
203
 	if ghost == nil {
197
 	if ghost == nil {
204
 		nsNotice(rb, client.t("No such nick"))
198
 		nsNotice(rb, client.t("No such nick"))
208
 		return
202
 		return
209
 	}
203
 	}
210
 
204
 
205
+	authorized := false
206
+	account := client.Account()
207
+	if account != "" {
208
+		// the user must either own the nick, or the target client
209
+		authorized = (server.accounts.NickToAccount(nick) == account) || (ghost.Account() == account)
210
+	}
211
+	if !authorized {
212
+		nsNotice(rb, client.t("You don't own that nick"))
213
+		return
214
+	}
215
+
211
 	ghost.Quit(fmt.Sprintf(ghost.t("GHOSTed by %s"), client.Nick()))
216
 	ghost.Quit(fmt.Sprintf(ghost.t("GHOSTed by %s"), client.Nick()))
212
 	ghost.destroy(false)
217
 	ghost.destroy(false)
213
 }
218
 }

Loading…
Annulla
Salva