[Differential] [Commented On] D4376: Replace long-deprecated getpass(3) call

A. Wilcox noreply at phabricator.kde.org
Tue Jan 31 19:29:23 UTC 2017


awilcox added a comment.


  > Out of interest: how did you stumble on that code?
  
  Using the musl libc, getpass is not defined unless you enable _GNU_SOURCE:
  
    [ 75%] Building C object kcheckpass/CMakeFiles/kcheckpass.dir/kcheckpass.c.o
    cd /usr/src/kde-plasma/kscreenlocker-5.8.5/work/kscreenlocker-5.8.5_build/kcheckpass && /usr/bin/gcc  -D_LARGEFILE64_SOURCE -D_XOPEN_SOURCE=600 -I/usr/src/kde-plasma/kscreenlocker-5.8.5/work/kscreenlocker-5.8.5_build/kcheckpass -I/usr/src/kde-plasma/kscreenlocker-5.8.5/work/kscreenlocker-5.8.5/kcheckpass -I/usr/src/kde-plasma/kscreenlocker-5.8.5/work/kscreenlocker-5.8.5_build   -DQT_NO_DEBUG -DNDEBUG -O2 -mlong-double-64 -ggdb -mcpu=G3 -fno-omit-frame-pointer  -std=iso9899:1990 -fno-common -Wall -Wextra -Wcast-align -Wchar-subscripts -Wformat-security -Wno-long-long -Wpointer-arith -Wundef -Wmissing-format-attribute -Wwrite-strings -Werror=implicit-function-declaration -std=gnu90 -fvisibility=hidden    -U_REENTRANT -o CMakeFiles/kcheckpass.dir/kcheckpass.c.o -c /usr/src/kde-plasma/kscreenlocker-5.8.5/work/kscreenlocker-5.8.5/kcheckpass/kcheckpass.c
    /usr/src/kde-plasma/kscreenlocker-5.8.5/work/kscreenlocker-5.8.5/kcheckpass/kcheckpass.c: In function ‘conv_legacy’:
    /usr/src/kde-plasma/kscreenlocker-5.8.5/work/kscreenlocker-5.8.5/kcheckpass/kcheckpass.c:105:10: error: implicit declaration of function ‘getpass’ [-Werror=implicit-function-declaration]
          p = getpass(prompt ? prompt : "Password: ");
              ^
    /usr/src/kde-plasma/kscreenlocker-5.8.5/work/kscreenlocker-5.8.5/kcheckpass/kcheckpass.c:105:8: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
          p = getpass(prompt ? prompt : "Password: ");
            ^
    cc1: some warnings being treated as errors
    kcheckpass/CMakeFiles/kcheckpass.dir/build.make:62: recipe for target 'kcheckpass/CMakeFiles/kcheckpass.dir/kcheckpass.c.o' failed
    make[2]: *** [kcheckpass/CMakeFiles/kcheckpass.dir/kcheckpass.c.o] Error 1
    make[2]: Leaving directory '/usr/src/kde-plasma/kscreenlocker-5.8.5/work/kscreenlocker-5.8.5_build'
    CMakeFiles/Makefile2:2042: recipe for target 'kcheckpass/CMakeFiles/kcheckpass.dir/all' failed
    make[1]: *** [kcheckpass/CMakeFiles/kcheckpass.dir/all] Error 2
  
  
  
  > If you think there is a risk: better be pedantic in this case. On the other hand getdelim should return -1 in error case and then your method returns null. So in my book that's good enough error checking.
  
  My concern was on the off-chance that getdelim reads a partial password but receives EOF before \n so it returns -1.  But, looking at the standard, there is no safe way to read/write to the buffer if the return code is -1, so that is actually a moot point.

REPOSITORY
  R133 KScreenLocker

REVISION DETAIL
  https://phabricator.kde.org/D4376

EMAIL PREFERENCES
  https://phabricator.kde.org/settings/panel/emailpreferences/

To: awilcox
Cc: graesslin, plasma-devel, lesliezhai, ali-mohamed, jensreuterberg, abetts, sebas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/plasma-devel/attachments/20170131/debd3d19/attachment-0001.html>


More information about the Plasma-devel mailing list