]> de.git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
rcon: support variable expansion in received commands
authorbones_was_here <bones_was_here@xonotic.au>
Tue, 2 Jan 2024 23:35:09 +0000 (09:35 +1000)
committerbones_was_here <bones_was_here@xonotic.au>
Wed, 3 Jan 2024 01:11:47 +0000 (11:11 +1000)
How to send such a command without the client expanding it is currently
left as an exercise for the reader...

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
netconn.c

index dc629271aa5c1bb05ea141872035d245e8e0dd43..7e64682575466266e4d666df9463b62a1f4cb7d9 100644 (file)
--- a/netconn.c
+++ b/netconn.c
@@ -3143,7 +3143,10 @@ static void RCon_Execute(lhnetsocket_t *mysocket, lhnetaddress_t *peeraddress, c
                        if(l)
                        {
                                client_t *host_client_save = host_client;
-                               Cmd_ExecuteString(cmd_local, s, src_local, true);
+                               //Cmd_ExecuteString(cmd_local, s, src_local, true); // no variable expansion
+                               // bones_was_here: prepending allows a loop such as `alias foo "bar; wait; foo"; foo`
+                               // to be broken with an alias or unalias command
+                               Cbuf_InsertText(cmd_local, s);
                                host_client = host_client_save;
                                // in case it is a command that changes host_client (like restart)
                        }