halflife icon indicating copy to clipboard operation
halflife copied to clipboard

Overwriting protected configs in 'writecfg' command

Open Splatt581 opened this issue 7 years ago • 9 comments

The writecfg command has restrictions on writing configs that can be automatically executed when client or server starts. Their list includes:

config.cfg
autoexec.cfg
listenserver.cfg
server.cfg
userconfig.cfg
  1. The check can be bypassed by adding a forward slash to beginning of name:
] writecfg config
skipping writecfg output, invalid filename given
] writecfg /config
/config.cfg successfully created!
  1. I also suggest adding to the list language.cfg, since game client tries to execute this config at startup as well.

Splatt581 avatar May 27 '19 19:05 Splatt581

HL1 also tries to execute violence.cfg on startup. It may still be worthwhile to add substring hw/ to list of blocked ones, so that configs for video cards that are on valve/hw/ path cannot be overwritten.

Splatt581 avatar May 29 '19 09:05 Splatt581

And also valve \ valve.rc

ghost avatar May 29 '19 10:05 ghost

And also valve \ valve.rc

writecfg can only write files with .cfg extension, so valve.rc cannot be overwritten.

Splatt581 avatar May 29 '19 11:05 Splatt581

Once, after connecting with one unreliable REHLDS server, a line appeared in this file: connect ip: port Perhaps not these, but by some other workaround, it was rewritten from the server side. Therefore, it is also a good idea to fix it here. It also modifies or creates the file "joystick.cfg", which is also readable if available.

ghost avatar May 29 '19 12:05 ghost

Fixed, this will be included in the next beta update.

mikela-valve avatar May 30 '19 02:05 mikela-valve

game.cfg joystick.cfg

BUXPb avatar May 30 '19 20:05 BUXPb

I think this list should also include banned.cfg, which uses cvar bannedcfgfile by default and listip.cfg, where writeip command writes data. HL1 also executes skill.cfg in a singleplayer game.

I will summarize resulting list:

language.cfg
violence.cfg
hw/
joystick.cfg
game.cfg
banned.cfg
listip.cfg
skill.cfg

Splatt581 avatar May 31 '19 18:05 Splatt581

Thanks @Splatt581. The list that will be blocked from writecfg is:

  • config.cfg
  • autoexec.cfg
  • listenserver.cfg
  • server.cfg
  • userconfig.cfg
  • language.cfg
  • violence.cfg
  • banned.cfg
  • listip.cfg
  • skill.cfg
  • game.cfg
  • joystick.cfg
  • hw/*.cfg

mikela-valve avatar May 31 '19 19:05 mikela-valve

I confirm, fixed in 8254 build.

Splatt581 avatar Jun 01 '19 04:06 Splatt581