Bug 389049 - stuck with sudo and wrong password
Summary: stuck with sudo and wrong password
Status: RESOLVED FIXED
Alias: None
Product: frameworks-kdesu
Classification: Frameworks and Libraries
Component: general (show other bugs)
Version: 5.42.0
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: kdelibs bugs
URL:
Keywords:
: 170155 292176 (view as bug list)
Depends on:
Blocks:
 
Reported: 2018-01-16 12:05 UTC by Harald Sitter
Modified: 2019-02-05 02:13 UTC (History)
5 users (show)

See Also:
Latest Commit:
Version Fixed In: 5.55
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Harald Sitter 2018-01-16 12:05:56 UTC
- run `/usr/lib/x86_64-linux-gnu/libexec/kf5/kdesu  -t ls`
- enter wrong password
- dialog stuck


Thread 6 (Thread 0x7f20ad5e6700 (LWP 3462)):
#0  pthread_cond_wait@@GLIBC_2.3.2 () at ../sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185
#1  0x00007f20b2d0e7f3 in ?? () from /usr/lib/x86_64-linux-gnu/dri/swrast_dri.so
#2  0x00007f20b2d0e657 in ?? () from /usr/lib/x86_64-linux-gnu/dri/swrast_dri.so
#3  0x00007f20d42636ba in start_thread (arg=0x7f20ad5e6700) at pthread_create.c:333
#4  0x00007f20d569e3dd in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109

Thread 5 (Thread 0x7f20adde7700 (LWP 3461)):
#0  pthread_cond_wait@@GLIBC_2.3.2 () at ../sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185
#1  0x00007f20b2d0e7f3 in ?? () from /usr/lib/x86_64-linux-gnu/dri/swrast_dri.so
#2  0x00007f20b2d0e657 in ?? () from /usr/lib/x86_64-linux-gnu/dri/swrast_dri.so
#3  0x00007f20d42636ba in start_thread (arg=0x7f20adde7700) at pthread_create.c:333
#4  0x00007f20d569e3dd in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109

Thread 4 (Thread 0x7f20ae5e8700 (LWP 3460)):
#0  pthread_cond_wait@@GLIBC_2.3.2 () at ../sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185
#1  0x00007f20b2d0e7f3 in ?? () from /usr/lib/x86_64-linux-gnu/dri/swrast_dri.so
#2  0x00007f20b2d0e657 in ?? () from /usr/lib/x86_64-linux-gnu/dri/swrast_dri.so
#3  0x00007f20d42636ba in start_thread (arg=0x7f20ae5e8700) at pthread_create.c:333
#4  0x00007f20d569e3dd in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109

Thread 3 (Thread 0x7f20bc912700 (LWP 3456)):
#0  0x00007f20d569270d in poll () at ../sysdeps/unix/syscall-template.S:84
#1  0x00007f20d262738c in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#2  0x00007f20d262749c in g_main_context_iteration () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#3  0x00007f20d5fb96cb in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) ()
   from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#4  0x00007f20d5f61e2a in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#5  0x00007f20d5d8a8f4 in QThread::exec() () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#6  0x00007f20d190a315 in ?? () from /usr/lib/x86_64-linux-gnu/libQt5DBus.so.5
#7  0x00007f20d5d8f709 in ?? () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#8  0x00007f20d42636ba in start_thread (arg=0x7f20bc912700) at pthread_create.c:333
#9  0x00007f20d569e3dd in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109

Thread 2 (Thread 0x7f20ca0fe700 (LWP 3455)):
#0  0x00007f20d569270d in poll () at ../sysdeps/unix/syscall-template.S:84
#1  0x00007f20d4b37c62 in ?? () from /usr/lib/x86_64-linux-gnu/libxcb.so.1
#2  0x00007f20d4b398d7 in xcb_wait_for_event () from /usr/lib/x86_64-linux-gnu/libxcb.so.1
#3  0x00007f20cc6551f9 in ?? () from /usr/lib/x86_64-linux-gnu/libQt5XcbQpa.so.5
#4  0x00007f20d5d8f709 in ?? () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#5  0x00007f20d42636ba in start_thread (arg=0x7f20ca0fe700) at pthread_create.c:333
#6  0x00007f20d569e3dd in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109

Thread 1 (Thread 0x7f20d84198c0 (LWP 3454)):
#0  0x00007f20d568e24d in read () at ../sysdeps/unix/syscall-template.S:84
#1  0x00007f20d7b0c778 in read (__nbytes=32768, __buf=0x12cb078, __fd=<optimized out>) at /usr/include/x86_64-linux-gnu/bits/unistd.h:44
#2  KDESu::PtyProcess::readAll (this=this@entry=0x7ffe96ba7358, block=<optimized out>, block@entry=true)
    at /workspace/build/src/ptyprocess.cpp:207
#3  0x00007f20d7b0cb5e in KDESu::PtyProcess::readLine (this=this@entry=0x7ffe96ba7358, block=block@entry=true)
    at /workspace/build/src/ptyprocess.cpp:228
#4  0x00007f20d7b1078a in KDESu::SuProcess::converseSU (this=this@entry=0x7ffe96ba7358, password=password@entry=0x12960d8 "asdf")
    at /workspace/build/src/suprocess.cpp:222
#5  0x00007f20d7b10f52 in KDESu::SuProcess::exec (this=0x7ffe96ba7358, password=0x12960d8 "asdf", check=1)
    at /workspace/build/src/suprocess.cpp:148
#6  0x0000000000408ae2 in ?? ()
#7  0x00007f20d802f035 in ?? () from /usr/lib/x86_64-linux-gnu/libKF5WidgetsAddons.so.5
#8  0x00007f20d5f912b9 in QObject::event(QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#9  0x00007f20d7440163 in QWidget::event(QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#10 0x00007f20d7400b9c in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#11 0x00007f20d74085a7 in QApplication::notify(QObject*, QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#12 0x00007f20d5f63df8 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#13 0x00007f20d5f665db in QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) ()
   from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#14 0x00007f20d5fba0a3 in ?? () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#15 0x00007f20d2627197 in g_main_context_dispatch () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#16 0x00007f20d26273f0 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#17 0x00007f20d262749c in g_main_context_iteration () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#18 0x00007f20d5fb96af in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) ()
   from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#19 0x00007f20d5f61e2a in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#20 0x00007f20d75ee6c7 in QDialog::exec() () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#21 0x00000000004078ca in ?? ()
#22 0x00007f20d55b7830 in __libc_start_main (main=0x405c70, argc=6, argv=0x7ffe96ba74d8, init=<optimized out>, fini=<optimized out>, 
    rtld_fini=<optimized out>, stack_end=0x7ffe96ba74c8) at ../csu/libc-start.c:291
#23 0x00000000004082c9 in _start ()
Comment 1 Harald Sitter 2018-01-16 13:07:28 UTC
after looking at the code a bit I am almost entirely certain that the problem is that converseSU doesn't correctly implement sudo handling

with su what happens is:

- state WaitForPrompt
- line="Password: "
- write wrong password to stdin
- state CheckStar
- line=""
- line empty
- state HandleStub
- line=(null)
- return notauthorized

with sudo

- state WaitForPrompt
- line="[sudo] password for $USER: "
- write wrong password to stdin
- state CheckStar
- line=""
- line empty
- state HandleStub
- line="Sorry, try again."
- stuck: sudo is wayting for a new password, we are waiting for a null line

"Sorry, try again." may appear 0-N times depending on sudoers configuration. We cannot influence this specifically. The only way to get anything of the sort going is if we ran sudo with --stdin and closed the fd (causing sudo to only read once and then implode; output would still be divergent from su though).

In any case the converseSU parsing needs to be made sudo compatible.
Comment 2 Jonathan Riddell 2018-02-21 14:45:34 UTC
https://phabricator.kde.org/D10716
Comment 3 Jonathan Riddell 2019-01-11 15:13:11 UTC
rebuilding with missing libudev-dev

(We have semi-automated checks for missing build deps but kaffeine doesn't report the missing dep in the normal way so it wasn't picked up)
Comment 4 Jonathan Riddell 2019-01-11 15:13:36 UTC
comment was for another bug
Comment 5 Jonathan Riddell 2019-01-12 11:42:19 UTC
should be sorted in kaffeine
2.0.15-0xneon+18.04+bionic+build5
Comment 6 Jonathan Riddell 2019-01-12 11:42:52 UTC
wrong bug again
Comment 7 Jonathan Riddell 2019-01-21 13:13:32 UTC
Git commit 2e8ce30c9498b0b3170a82b55ca12277feba21da by Jonathan Riddell.
Committed on 21/01/2019 at 13:13.
Pushed by jriddell into branch 'master'.

handle wrong password when using sudo which asks for another password

Summary:
handle wrong password when using sudo which asks for another password

Test Plan: build and run with sudo and su options, test password and no, test diff languages

Reviewers: sitter, fvogt

Reviewed By: sitter, fvogt

Subscribers: starbuck, fvogt, kde-frameworks-devel

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D10716

M  +4    -0    CMakeLists.txt
A  +4    -0    autotests/CMakeLists.txt
A  +2    -0    autotests/config-kdesutest.h.cmake
A  +98   -0    autotests/kdesutest.cpp     [License: LGPL]
A  +38   -0    autotests/su
A  +54   -0    autotests/sudo
M  +10   -3    src/suprocess.cpp

https://commits.kde.org/kdesu/2e8ce30c9498b0b3170a82b55ca12277feba21da
Comment 8 Jiri Palecek 2019-02-05 02:12:58 UTC
*** Bug 292176 has been marked as a duplicate of this bug. ***
Comment 9 Jiri Palecek 2019-02-05 02:13:53 UTC
*** Bug 170155 has been marked as a duplicate of this bug. ***