/mandos/trunk

To get this branch, use:
bzr branch http://bzr.recompile.se/loggerhead/mandos/trunk

« back to all changes in this revision

Viewing changes to dracut-module/password-agent.c

  • Committer: Teddy Hogeborn
  • Date: 2024-09-09 04:24:39 UTC
  • Revision ID: teddy@recompile.se-20240909042439-j85mr20uli2hnyis
Eliminate compiler warnings

Many programs use nested functions, which now result in a linker
warning about executable stack.  Hide this warning.  Also, rewrite a
loop in the plymouth plugin to avoid warning about signed overflow.
This change also makes the plugin pick the alphabetically first
process entry instead of the last, in case many plymouth processes are
found (which should be unlikely).

* Makefile (plugin-runner, dracut-module/password-agent,
  plugins.d/password-prompt, plugins.d/mandos-client,
  plugins.d/plymouth): New target; set LDFLAGS to add "-Xlinker
  --no-warn-execstack".
* plugins.d/plymouth.c (get_pid): When no pid files are found, and we
  are looking through the process list, go though it from the start
  instead of from the end, i.e. in normal alphabetical order and not
  in reverse order.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1488
1488
    if(send_buffer == NULL){
1489
1489
      error(0, errno, "Failed to allocate send_buffer");
1490
1490
    } else {
 
1491
#if defined(__GNUC__) and __GNUC__ >= 5
 
1492
#pragma GCC diagnostic push
 
1493
  /* mlock() does not access the memory */
 
1494
#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
 
1495
#endif
1491
1496
      if(mlock(send_buffer, send_buffer_length) != 0){
 
1497
#if defined(__GNUC__) and __GNUC__ >= 5
 
1498
#pragma GCC diagnostic pop
 
1499
#endif
1492
1500
        /* Warn but do not treat as fatal error */
1493
1501
        if(errno != EPERM and errno != ENOMEM){
1494
1502
          error(0, errno, "Failed to lock memory for password"
2661
2669
  bool password_is_read = false;
2662
2670
  const char helper_directory[] = "/nonexistent";
2663
2671
  const char *const argv[] = { "/bin/sh", "-c",
2664
 
    "echo -n ${MANDOSPLUGINHELPERDIR}", NULL };
 
2672
    "printf %s \"${MANDOSPLUGINHELPERDIR}\"", NULL };
2665
2673
 
2666
2674
  const bool success = start_mandos_client(queue, epoll_fd,
2667
2675
                                           &mandos_client_exited,
4847
4855
  memcpy(ievent->name, dummy_file_name, sizeof(dummy_file_name));
4848
4856
  const size_t ievent_size = (sizeof(struct inotify_event)
4849
4857
                              + sizeof(dummy_file_name));
 
4858
#if defined(__GNUC__) and __GNUC__ >= 11
 
4859
#pragma GCC diagnostic push
 
4860
  /* ievent is pointing into a struct which is of sufficient size */
 
4861
#pragma GCC diagnostic ignored "-Wstringop-overread"
 
4862
#endif
4850
4863
  g_assert_cmpint(write(pipefds[1], (char *)ievent, ievent_size),
4851
4864
                  ==, ievent_size);
 
4865
#if defined(__GNUC__) and __GNUC__ >= 11
 
4866
#pragma GCC diagnostic pop
 
4867
#endif
4852
4868
  g_assert_cmpint(close(pipefds[1]), ==, 0);
4853
4869
 
4854
4870
  bool quit_now = false;