Closed 2press closed 6 years ago
I've discovered the issue.. a "Control-Z" is added to the end of the config.ini file!
For LINUX it is ~/.config/obs-studio/config.ini :+1:
[WebsocketAPI] ... AuthSecret=[....]zlk=^Z AuthSalt=[...]XHEY=^Z
Remove the Control-Z (last character from each line) and the new password will be accepted. Must be a bug in stringing the Secret/Salt that was introduced.
I can poke at the diff from 4.3.1/0 and prior to see what changes occurred (I don't know the source code). If I find a fix and make a patch.. I'll try to get back to it, but suspect Palakis might fix this before then. Seems pretty simple.
--Doug (dx9s)
Found ruffly where it is:
--Doug (dx9s)
I am not sure what qstring_data_copy does():
used to be:
- config_set_string(obs_config, SECTION_NAME, PARAM_SECRET, Secret);
- config_set_string(obs_config, SECTION_NAME, PARAM_SALT, Salt);
now:
+ config_set_string(obsConfig, SECTION_NAME, PARAM_SECRET,
+ qstring_data_copy(Secret));
+ config_set_string(obsConfig, SECTION_NAME, PARAM_SALT,
+ qstring_data_copy(Salt));
--Doug (dx9s)
see it here: Utils.cpp :
const char* qstring_data_copy(QString value) {
QByteArray stringData = value.toUtf8();
const char* constStringData = new const char[stringData.size()]();
memcpy((void*)constStringData, stringData.constData(), stringData.size());
return constStringData;
}
Not sure if you want to actually convert base64-like data into UTF .. that can damage the data. I'd recommend rolling it back, but the types went from char * to QString .. would need to look further is "Salt" and "Secret" is the binary form, base64-like form, or what. It effects on where you should do any "UTF-ness" to it or not.
--Doug (dx9s)
Got this output... Now scratching my head:
obs-websocket [SettingsDialog::FormAccepted Password Set]:HelloWorld
obs-websocket [qstring_data_copy_test value]:akiN0rgCjvrOaNXy8DvCCkJslpSKzbpLdz/XpksV71Q=
obs-websocket [qstring_data_copy_test constStringData]: akiN0rgCjvrOaNXy8DvCCkJslpSKzbpLdz/XpksV71Q=
obs-websocket [qstring_data_copy_test value]:bp0BSRjEnw7gkXcKxF+sK5Keb6BOfcEdCj3oVBlpImY=
obs-websocket [qstring_data_copy_test constStringData]: bp0BSRjEnw7gkXcKxF+sK5Keb6BOfcEdCj3oVBlpImY=
Diff's speak a 1000 words:
index c164996..8f263b6 100644
--- a/src/Config.cpp
+++ b/src/Config.cpp
@@ -104,9 +104,9 @@ void Config::Save() {
config_set_bool(obsConfig, SECTION_NAME, PARAM_AUTHREQUIRED, AuthRequired);
config_set_string(obsConfig, SECTION_NAME, PARAM_SECRET,
- qstring_data_copy(Secret));
+ qstring_data_copy_test(Secret));
config_set_string(obsConfig, SECTION_NAME, PARAM_SALT,
- qstring_data_copy(Salt));
+ qstring_data_copy_test(Salt));
config_save(obsConfig);
}
diff --git a/src/Utils.cpp b/src/Utils.cpp
index 93c29c1..d48fcd3 100644
--- a/src/Utils.cpp
+++ b/src/Utils.cpp
@@ -35,6 +35,19 @@ const char* qstring_data_copy(QString value) {
return constStringData;
}
+const char* qstring_data_copy_test(QString value) {
+ QByteArray stringData = value.toUtf8();
+
+ qDebug("obs-websocket [qstring_data_copy_test value]:" + value.toUtf8() );
+
+ const char* constStringData = new const char[stringData.size()]();
+ memcpy((void*)constStringData, stringData.constData(), stringData.size());
+
+ fprintf(stdout, "obs-websocket [qstring_data_copy_test constStringData]: %s\n", constStringData);
+
+ return constStringData;
+}
+
obs_data_array_t* Utils::StringListToArray(char** strings, char* key) {
if (!strings)
return obs_data_array_create();
diff --git a/src/Utils.h b/src/Utils.h
index 116c6e4..56c238a 100644
--- a/src/Utils.h
+++ b/src/Utils.h
@@ -33,6 +33,7 @@ with this program. If not, see <https://www.gnu.org/licenses/>
#include <util/config-file.h>
const char* qstring_data_copy(QString value);
+const char* qstring_data_copy_test(QString value);
class Utils {
public:
diff --git a/src/forms/settings-dialog.cpp b/src/forms/settings-dialog.cpp
index 059ba4e..5b6d104 100644
--- a/src/forms/settings-dialog.cpp
+++ b/src/forms/settings-dialog.cpp
@@ -80,6 +80,7 @@ void SettingsDialog::FormAccepted() {
if (ui->authRequired->isChecked()) {
if (ui->password->text() != CHANGE_ME) {
conf->SetPassword(ui->password->text());
+ qDebug("obs-websocket [SettingsDialog::FormAccepted Password Set]:" + ui->password->text().toUtf8() );
}
if (!Config::Current()->Secret.isEmpty())
@dx9s Thanks for the investigation! That's a very nasty bug...
I guess this has something to do with constData()
. maybe data()
doesn't have that issue.
@Palakis I think it might be const .. I did (and from memory) something along the following:
//very hackish no each "size" ? or strlen equiv
QChar* data = value.data();
int size=0;
while (!data->isNull()) {
// data.unicode(); or something like this -- printed out the number and this appeared good!
data++;
size++;
}
wow.. still getting this (hackish to simple step debug closer) same output:
obs-websocket [SettingsDialog::FormAccepted Password Set]:test123
obs-websocket [qstring_data_copy_test value]:bplRFv+PaoXp0VOCZ5kxKTFrRlHoSdzyJ0kZVZpRg0Y=
obs-websocket [qstring_data_copy_test constStringData]: bplRFv+PaoXp0VOCZ5kxKTFrRlHoSdzyJ0kZVZpRg0Y=
obs-websocket [qstring_data_copy_test value]:4tKDXc0N0FzncgsBcfXtQP6C3sUqgcOVQB3JMkFKY4c=
obs-websocket [qstring_data_copy_test constStringData]: 4tKDXc0N0FzncgsBcfXtQP6C3sUqgcOVQB3JMkFKY4c=
Using this function (also updating Utils.h to prototype correctly):
const char* qstring_data_copy(QString value) {
QByteArray stringData = value.toUtf8();
const char* constStringData = new const char[stringData.size()]();
memcpy((void*)constStringData, stringData.constData(), stringData.size());
return constStringData;
}
char* qstring_data_copy_test(QString value) {
QByteArray stringData = value.toUtf8();
qDebug("obs-websocket [qstring_data_copy_test value]:" + value.toUtf8() );
//very hackish no each "size" ? or strlen equiv
QChar* data = value.data();
int size=0;
while (!data->isNull()) {
data++;
size++;
}
char* stringDataOut = new char[size]();
//memcpy((void*)stringDataOut, stringData.data(), size);
int x;
data = value.data();
size=0;
while (!data->isNull()) {
x = data->unicode();
stringDataOut[size]=(char)x;
data++;
size++;
}
fprintf(stdout, "obs-websocket [qstring_data_copy_test constStringData]: %s\n", stringDataOut);
return stringDataOut;
}
The bug is either in new char[size](); (or const equiv)
or QChar/QByteArray/QString conversions
Have this out there...
https://github.com/Palakis/obs-websocket/pull/196 -- It might not be the best solution / workaround ?!
@dx9s Can you test the changes introduced in https://github.com/Palakis/obs-websocket/commit/e168b78cc13cb0a44d4bb32c795eae2b3e884eb9, please?
checked out 7fdace9b79759ef9d558b5d6f00b1677f2338612 and it seems to have fixed the stringing issue..
Still seeing memory leaks with JUST obs-websocket installed (also seeing memory leaks from obs-ndi).. I am not verse in gdb and debugging leaks and crashes / core-dumps.
Worried about the memory leaks (obs-websocket and obs-ndi) being related to obs crashing and obs-ndi not working (sourcing video to OBS). Or what I saw in another issue about recent obs-websocket crashing in newer version of OSX .. probably something so subtle!
--Doug (dx9s)
FWIW:
dx@x99:~/git/obs-websocket/build$ obs
Attempted path: share/obs/obs-studio/locale/en-US.ini
Attempted path: /usr/share/obs/obs-studio/locale/en-US.ini
Attempted path: share/obs/obs-studio/locale.ini
Attempted path: /usr/share/obs/obs-studio/locale.ini
Attempted path: share/obs/obs-studio/themes/Default.qss
Attempted path: /usr/share/obs/obs-studio/themes/Default.qss
Attempted path: share/obs/obs-studio/license/gplv2.txt
Attempted path: /usr/share/obs/obs-studio/license/gplv2.txt
info: CPU Name: Intel(R) Core(TM) i7-6850K CPU @ 3.60GHz
info: CPU Speed: 3597.596MHz
info: Physical Cores: 6, Logical Cores: 12
info: Physical Memory: 64325MB Total, 61108MB Free
info: Kernel Version: Linux 4.13.0-37-generic
info: Distribution: "Ubuntu" "17.10"
info: Portable mode: false
QMetaObject::connectSlotsByName: No matching signal for on_advAudioProps_clicked()
QMetaObject::connectSlotsByName: No matching signal for on_advAudioProps_destroyed()
QMetaObject::connectSlotsByName: No matching signal for on_program_customContextMenuRequested(QPoint)
info: OBS 21.0.1 (linux)
info: ---------------------------------
info: ---------------------------------
info: audio settings reset:
samples per sec: 44100
speakers: 2
info: ---------------------------------
info: Initializing OpenGL...
info: OpenGL version: 3.2.0 NVIDIA 384.111
info: ---------------------------------
info: video settings reset:
base resolution: 1920x1080
output resolution: 1280x720
downscale filter: Bicubic
fps: 30000/1001
format: NV12
info: Audio monitoring device:
name: Monitor of Built-in Audio Analog Stereo
id: alsa_output.pci-0000_00_1b.0.analog-stereo.monitor
info: ---------------------------------
info: NVENC supported
info: [obs-websocket] you can haz websockets (version 4.3.1)
info: [obs-websocket] qt version (compile-time): 5.9.1 ; qt version (run-time): 5.9.1
info: [obs-websocket] server started successfully on TCP port 4444
info: [obs-websocket] module loaded!
info: VLC found, VLC video source enabled
info: ---------------------------------
info: Loaded Modules:
info: qtwebkit-browser.so
info: vlc-video.so
info: text-freetype2.so
info: rtmp-services.so
info: obs-x264.so
info: obs-websocket.so
info: obs-transitions.so
info: obs-outputs.so
info: obs-libfdk.so
info: obs-filters.so
info: obs-ffmpeg.so
info: linux-v4l2.so
info: linux-pulseaudio.so
info: linux-jack.so
info: linux-decklink.so
info: linux-capture.so
info: linux-alsa.so
info: image-source.so
info: frontend-tools.so
info: ---------------------------------
info: ==== Startup complete ===============================================
info: All scene data cleared
info: ------------------------------------------------
info: pulse-input: Server name: 'pulseaudio 10.0'
info: pulse-input: Audio format: s16le, 44100 Hz, 2 channels
info: pulse-input: Started recording from 'alsa_input.usb-Burr-Brown_from_TI_USB_Audio_CODEC-00.analog-stereo.2'
info: pulse-am: Server name: 'pulseaudio 10.0'
info: pulse-am: Audio format: s16le, 44100 Hz, 2 channels
info: pulse-am: Started Monitoring in 'alsa_output.pci-0000_00_1b.0.analog-stereo.monitor'
info: v4l2-input: Start capture from /dev/video1
info: v4l2-input: Input: 0
info: v4l2-input: Resolution: 1280x720
info: v4l2-input: Pixelformat: 21UY
info: v4l2-input: Linesize: 1280 Bytes
info: v4l2-input: Framerate: 30.00 fps
info: v4l2-input: Start capture from /dev/video0
info: v4l2-input: Input: 0
info: v4l2-input: Resolution: 1920x1080
info: v4l2-input: Pixelformat: 21UY
info: v4l2-input: Linesize: 1920 Bytes
info: v4l2-input: Framerate: 59.94 fps
info: Switched to scene '-4-GAMEON-DX'
info: ------------------------------------------------
info: Loaded scenes:
info: - scene '-0-BLANK':
info: - scene '-1-STANDBY':
info: - source: 'StandByStatic' (qtwebkit-source)
info: - scene '-2-BEGIN':
info: - source: 'BeginingShortly' (qtwebkit-source)
info: - scene '-3-SPLASH':
info: - source: 'GAME-IMG' (image_source)
info: - filter: 'Darken' (color_filter)
info: - source: 'Names' (text_ft2_source)
info: - source: 'SLChatBox' (qtwebkit-source)
info: - source: 'SLAlertBox' (qtwebkit-source)
info: - source: 'DVoiceBox' (qtwebkit-source)
info: - source: 'SLCountBox' (qtwebkit-source)
info: - source: 'CAM-DX' (v4l2_input)
info: - scene '-4-GAMEON-DX':
info: - source: 'CAM-DX' (v4l2_input)
info: - source: 'GAME-DX' (v4l2_input)
info: - source: 'OVERLAY' (image_source)
info: - source: 'SLChatBox' (qtwebkit-source)
info: - source: 'SLCountBox' (qtwebkit-source)
info: - source: 'SLAlertBox' (qtwebkit-source)
info: - scene '-4-GAMEON-JD':
info: - source: 'CAM-DX' (v4l2_input)
info: - source: 'GAME-DX' (v4l2_input)
info: - source: 'OVERLAY' (image_source)
info: - source: 'SLChatBox' (qtwebkit-source)
info: - source: 'SLCountBox' (qtwebkit-source)
info: - source: 'SLAlertBox' (qtwebkit-source)
info: ------------------------------------------------
info: adding 23 milliseconds of audio buffering, total audio buffering is now 23 milliseconds
info: adding 23 milliseconds of audio buffering, total audio buffering is now 46 milliseconds
info: [obs-websocket] new client connection from 192.168.1.188:42883
info: User switched to scene '-4-GAMEON-JD'
info: User switched to scene '-4-GAMEON-DX'
info: User switched to scene '-4-GAMEON-JD'
info: User switched to scene '-4-GAMEON-DX'
info: User switched to scene '-4-GAMEON-JD'
info: User switched to scene '-3-SPLASH'
info: User switched to scene '-4-GAMEON-JD'
info: ==== Shutting down ==================================================
info: Switched to scene '(null)'
info: v4l2-input: Stopped capture after 305 frames
info: v4l2-input: Stopped capture after 1243 frames
QSocketNotifier: Socket notifiers cannot be enabled or disabled from another thread
QSocketNotifier: Socket notifiers cannot be enabled or disabled from another thread
QSocketNotifier: Socket notifiers cannot be enabled or disabled from another thread
QSocketNotifier: Socket notifiers cannot be enabled or disabled from another thread
QSocketNotifier: Socket notifiers cannot be enabled or disabled from another thread
QSocketNotifier: Socket notifiers cannot be enabled or disabled from another thread
info: pulse-input: Stopped recording from 'alsa_input.usb-Burr-Brown_from_TI_USB_Audio_CODEC-00.analog-stereo.2'
info: pulse-input: Got 2140 packets with 937875 frames
info: pulse-am: Stopped Monitoring in 'alsa_output.pci-0000_00_1b.0.analog-stereo.monitor'
info: pulse-am: Got 2089 packets with 915472 frames
info: All scene data cleared
info: ------------------------------------------------
info: Freeing OBS context data
info: [obs-websocket] goodbye!
info: [Scripting] Total detached callbacks: 0
info: == Profiler Results =============================
info: run_program_init: 649.311 ms
info: ┣OBSApp::AppInit: 1.018 ms
info: ┃ ┗OBSApp::InitLocale: 0.832 ms
info: ┗OBSApp::OBSInit: 573.461 ms
info: ┣obs_startup: 12.677 ms
info: ┗OBSBasic::OBSInit: 515.984 ms
info: ┣OBSBasic::InitBasicConfig: 0.068 ms
info: ┣OBSBasic::ResetAudio: 0.13 ms
info: ┣OBSBasic::ResetVideo: 84.985 ms
info: ┣OBSBasic::InitOBSCallbacks: 0.003 ms
info: ┣OBSBasic::InitHotkeys: 0.033 ms
info: ┣obs_load_all_modules: 80.706 ms
info: ┃ ┣obs_init_module(frontend-tools.so): 35.535 ms
info: ┃ ┣obs_init_module(image-source.so): 0.003 ms
info: ┃ ┣obs_init_module(linux-alsa.so): 0.001 ms
info: ┃ ┣obs_init_module(linux-capture.so): 0.347 ms
info: ┃ ┣obs_init_module(linux-decklink.so): 4.194 ms
info: ┃ ┣obs_init_module(linux-jack.so): 0.002 ms
info: ┃ ┣obs_init_module(linux-pulseaudio.so): 0.002 ms
info: ┃ ┣obs_init_module(linux-v4l2.so): 0.001 ms
info: ┃ ┣obs_init_module(obs-ffmpeg.so): 1.369 ms
info: ┃ ┃ ┗nvenc_check: 1.29 ms
info: ┃ ┣obs_init_module(obs-filters.so): 0.01 ms
info: ┃ ┣obs_init_module(obs-libfdk.so): 0.001 ms
info: ┃ ┣obs_init_module(obs-outputs.so): 0.004 ms
info: ┃ ┣obs_init_module(obs-transitions.so): 0.008 ms
info: ┃ ┣obs_init_module(obs-websocket.so): 1.198 ms
info: ┃ ┣obs_init_module(obs-x264.so): 0.001 ms
info: ┃ ┣obs_init_module(rtmp-services.so): 0.392 ms
info: ┃ ┣obs_init_module(text-freetype2.so): 0.006 ms
info: ┃ ┣obs_init_module(vlc-video.so): 0.684 ms
info: ┃ ┗obs_init_module(qtwebkit-browser.so): 0.004 ms
info: ┣OBSBasic::ResetOutputs: 0.117 ms
info: ┣OBSBasic::CreateHotkeys: 0.018 ms
info: ┣OBSBasic::InitService: 0.704 ms
info: ┣OBSBasic::InitPrimitives: 1.412 ms
info: ┗OBSBasic::Load: 243.782 ms
info: obs_hotkey_thread(25 ms): min=0.06 ms, median=0.149 ms, max=2.353 ms, 99th percentile=0.277 ms, 100% below 25 ms
info: audio_thread(Audio): min=0 ms, median=0.073 ms, max=7.05 ms, 99th percentile=1.449 ms
info: obs_graphics_thread(33.3667 ms): min=1.388 ms, median=3.78 ms, max=186.179 ms, 99th percentile=9.734 ms, 99.843% below 33.367 ms
info: ┣tick_sources: min=0 ms, median=1.168 ms, max=182.459 ms, 99th percentile=1.578 ms
info: ┣output_frame: min=0.815 ms, median=2.051 ms, max=24.457 ms, 99th percentile=5.161 ms
info: ┃ ┣gs_context(video->graphics): min=0.522 ms, median=1.693 ms, max=24.457 ms, 99th percentile=4.867 ms
info: ┃ ┃ ┣render_video: min=0.294 ms, median=1.543 ms, max=8.751 ms, 99th percentile=4.458 ms
info: ┃ ┃ ┃ ┣render_main_texture: min=0.066 ms, median=1.323 ms, max=8.565 ms, 99th percentile=3.613 ms
info: ┃ ┃ ┃ ┣render_output_texture: min=0.002 ms, median=0.072 ms, max=7.093 ms, 99th percentile=0.145 ms
info: ┃ ┃ ┃ ┣render_convert_texture: min=0.001 ms, median=0.07 ms, max=0.809 ms, 99th percentile=0.123 ms
info: ┃ ┃ ┃ ┗stage_output_texture: min=0 ms, median=0.04 ms, max=4.252 ms, 99th percentile=0.193 ms
info: ┃ ┃ ┣download_frame: min=0 ms, median=0.003 ms, max=0.015 ms, 99th percentile=0.012 ms
info: ┃ ┃ ┗gs_flush: min=0.004 ms, median=0.01 ms, max=0.033 ms, 99th percentile=0.02 ms
info: ┃ ┗output_video_data: min=0.225 ms, median=0.353 ms, max=0.779 ms, 99th percentile=0.495 ms
info: ┗render_displays: min=0.068 ms, median=0.486 ms, max=6.884 ms, 99th percentile=1.281 ms
info: video_thread(video): min=0 ms, median=0.001 ms, max=0.065 ms, 99th percentile=0.002 ms
info: =================================================
info: == Profiler Time Between Calls ==================
info: obs_hotkey_thread(25 ms): min=25.123 ms, median=25.232 ms, max=27.423 ms, 99.1765% within ±2% of 25 ms (0% lower, 0.823529% higher)
info: obs_graphics_thread(33.3667 ms): min=14.014 ms, median=33.367 ms, max=186.186 ms, 99.6855% within ±2% of 33.367 ms (0.157233% lower, 0.157233% higher)
info: =================================================
info: Number of memory leaks: 2
Fixed! Release coming soon.
Issue type
Bug
Description
Authentication Password isn't saved correctly. Thus after restarting OBS the password is no longer valid. I tried to reinstall from scratch as well as version 4.3.1 and 4.3.0. But I didn't have this problem previously with version 4.3.0.
Technical information