This commit is contained in:
DavidXanatos 2024-06-15 10:55:10 +02:00
parent 7a2a6e1728
commit e2c312a635
3 changed files with 55 additions and 4 deletions

View File

@ -7,6 +7,11 @@ This project adheres to [Semantic Versioning](http://semver.org/).
## [1.14.2 / 5.69.2] - 2024-06-??
### Added
- added SbieIni option to modify password-protected configs [#3903](https://github.com/sandboxie-plus/Sandboxie/issues/3903)
- usage: set|append|insert|delete [/passwd:********] <section> <setting> <value>
- note: use /passwd without the password to have SbieIni prompot for the password on the console, this hides the password from view and from bing captured with the command line
### Fixed
- fixed security issue with the newly introduced experimental "UseCreateToken=y" machanism
- fixed issue with "UseCreateToken=y" when using a MSFT online account

View File

@ -30,6 +30,7 @@
#define ERRLVL_CMDLINE 1
#define ERRLVL_PASSWD 2
//---------------------------------------------------------------------------

View File

@ -22,7 +22,7 @@
#include "global.h"
#include "core/dll/sbiedll.h"
#include <wchar.h>
//---------------------------------------------------------------------------
// DoUpdate
@ -45,7 +45,7 @@ int DoUpdate(void)
if (usage_error) {
const WCHAR *_usage =
L"set|append|insert|delete <section> <setting> <value>\n"
L"set|append|insert|delete [/passwd:********] <section> <setting> <value>\n"
L"- set: replaces a setting with a new value"
L" if value is omitted,\n"
L" the setting will be removed entirely\n"
@ -56,7 +56,9 @@ int DoUpdate(void)
L" at the top of the\n"
L" existing list of lines\n"
L"- delete: removes a value line which matches"
L" the specified value\n";
L" the specified value\n"
L"- specify /passwd: with password to use modify"
L" a password config\n";
UsageError(_usage);
}
@ -72,8 +74,51 @@ int DoUpdate(void)
else
return ERRLVL_CMDLINE;
WCHAR* passwd = CmdOpt(L"passwd");
WCHAR password[128];
if (passwd && !*passwd) {
printf("Enter config password: ");
int i = 0;
WCHAR ch;
while (1) {
ch = _getwch();
if (ch == L'\r') {
password[i] = L'\0';
printf("\n");
passwd = password;
break;
} else if (ch == 27) { // Check for Escape key (ASCII code 27)
passwd = NULL;
break;
} else if (ch == L'\b') {
if (i > 0) {
printf("\b \b");
i--;
}
} else {
if (i < ARRAYSIZE(password) - 1) {
password[i++] = ch;
printf("*");
}
}
}
if (!passwd)
return 0;
}
status = SbieDll_UpdateConf(
op, NULL, CmdVerb(1), CmdVerb(2), CmdVerb(3));
op, passwd, CmdVerb(1), CmdVerb(2), CmdVerb(3));
if (status == 0xC000006AL/*STATUS_WRONG_PASSWORD*/) {
printf("Password Invalid");
return ERRLVL_PASSWD;
}
return 0;
}