Project

General

Profile

Actions

Bug #3494

closed

Detection of privilege drop/elevation is broken

Added by Davide Pesavento about 8 years ago. Updated almost 8 years ago.

Status:
Closed
Priority:
Normal
Category:
Build
Target version:
Start date:
Due date:
% Done:

0%

Estimated time:

Description

We're supplying nullptr where a non-null pointer is required.

Checking if privilege drop/elevation is supported
==>

#include <unistd.h>
#include <pwd.h>
#include <grp.h>
int
main(int, char**)
{
  ::sysconf(_SC_GETGR_R_SIZE_MAX);
  group grp;
  getgrnam_r("nogroup", &grp, nullptr, 0, nullptr);
  passwd pwd;
  getpwnam_r("nobody", &pwd, nullptr, 0, nullptr);

  int ret = setegid(grp.gr_gid);
  ret = seteuid(pwd.pw_uid);
  (void)(ret);
  return 0;
}

<==
[1/2] Compiling build/.conf_check_e46c61fb80ccd95766eb2f772067a5f2/test.cpp

['/usr/bin/g++', '-O0', '-g3', '-pedantic', '-Wall', '-Wextra', '-Werror', '-Wno-unused-parameter', '-Wno-error=maybe-uninitialized', '-Wno-missing-field-initializers', '-Og', '-fdiagnostics-color', '-std=c++11', '-D_DEBUG', '-DHAVE_IS_DEFAULT_CONSTRUCTIBLE=1', '-DHAVE_IS_MOVE_CONSTRUCTIBLE=1', '-DHAVE_CXX_OVERRIDE=1', '-DHAVE_CXX_FINAL=1', '-DHAVE_CXX_CLASS_FINAL=1', '-DHAVE_LIBRT=1', '-DHAVE_LIBRESOLV=1', '../test.cpp', '-c', '-o', '/home/davide/NFD/build/.conf_check_e46c61fb80ccd95766eb2f772067a5f2/testbuild/test.cpp.1.o']
err: ../test.cpp: In function ‘int main(int, char**)’:
../test.cpp:12:49: error: null argument where non-null required (argument 3) [-Werror=nonnull]
   getpwnam_r("nobody", &pwd, nullptr, 0, nullptr);
                                                 ^
../test.cpp:12:49: error: null argument where non-null required (argument 5) [-Werror=nonnull]
cc1plus: all warnings being treated as errors

from /home/davide/NFD: Test does not build: Traceback (most recent call last):
  File "/home/davide/NFD/.waf3-1.8.9-8a9ccbc1c5d3936b0b08e972e4883a9a/waflib/Configure.py", line 343, in run_build
    bld.compile()
  File "/home/davide/NFD/.waf3-1.8.9-8a9ccbc1c5d3936b0b08e972e4883a9a/waflib/Build.py", line 184, in compile
    raise Errors.BuildError(self.producer.error)
waflib.Errors.BuildError: Build failed

Related issues 2 (0 open2 closed)

Related to NFD - Bug #4296: Xcode >= 9.0 triggers -Wundefined-func-template warnings/errors in boost headersClosedAlex Afanasyev

Actions
Has duplicate NFD - Bug #3633: Privilege drop/elevation is not detected on Ubuntu 16.04 with --debugClosedAlex Afanasyev05/25/2016

Actions
Actions #1

Updated by Alex Afanasyev almost 8 years ago

  • Has duplicate Bug #3633: Privilege drop/elevation is not detected on Ubuntu 16.04 with --debug added
Actions #2

Updated by Junxiao Shi almost 8 years ago

  • Status changed from New to Closed
  • Assignee set to Alex Afanasyev
Actions #3

Updated by Davide Pesavento over 6 years ago

  • Related to Bug #4296: Xcode >= 9.0 triggers -Wundefined-func-template warnings/errors in boost headers added
Actions

Also available in: Atom PDF