/mandos/release

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

« back to all changes in this revision

Viewing changes to plugins.d/askpass-fifo.c

  • Committer: Teddy Hogeborn
  • Date: 2019-11-03 18:44:41 UTC
  • mto: This revision was merged to the branch mainline in revision 396.
  • Revision ID: teddy@recompile.se-20191103184441-1vhjuf06hjqgfohh
mandos-monitor: Use Python's standard loggging module

* mandos-monitor: Use Python's standard loggging module, also for
                  warnings.  Suppress BytesWarning from urwid when
                  exiting.
  (log): New global logger object.  This replaces UserInterface
        log_message().
  (MandosClientWidget.__init__): Remove "logger" argument.
  (MandosClientWidget.using_timer): Wrap self.update_timer using new
                                    glib_safely() function.
  (glib_safely): New function to log any exceptions instead of letting
                 exceptions propagate up to GLib.
  (UserInterface.__init__): Remove "log_level" argument.  Set new
                            "loghandler" attribute, instance of new
                            "UILogHandler".
  (UserInterface.log_message): Removed.
  (UserInterface.log_message_raw): Renamed to "add_log_line"; all
                                   callers changed.  Also fix
                                   off-by-one error in max_log_length
                                   logic.
  (UserInterface.run): Add self.loghandler to logger "log". Wrap
                       self.process_input using new glib_safely()
                       function.
  (UserInterface.stop): Remove self.loghandler from logger "log".
  (UserInterface.process_input): Make verbosity toggle affect log
                                 level of logger "log".
  (UILogHandler): New.

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
/*
3
3
 * Askpass-FIFO - Read a password from a FIFO and output it
4
4
 * 
5
 
 * Copyright © 2008-2019, 2021 Teddy Hogeborn
6
 
 * Copyright © 2008-2019, 2021 Björn Påhlsson
 
5
 * Copyright © 2008-2019 Teddy Hogeborn
 
6
 * Copyright © 2008-2019 Björn Påhlsson
7
7
 * 
8
8
 * This file is part of Mandos.
9
9
 * 
23
23
 * Contact the authors at <mandos@recompile.se>.
24
24
 */
25
25
 
26
 
#define _GNU_SOURCE             /* vasprintf(),
27
 
                                   program_invocation_short_name */
28
 
#include <sys/types.h>          /* uid_t, gid_t, getuid(), getgid(),
29
 
                                   setgid(), setuid() */
30
 
#include <unistd.h>             /* uid_t, gid_t, ssize_t, getuid(),
31
 
                                   getgid(), setgid(), setuid(),
32
 
                                   read(), close(), write(),
33
 
                                   STDOUT_FILENO */
34
 
#include <stdarg.h>             /* va_list, va_start(), vfprintf() */
35
 
#include <stdio.h>              /* vasprintf(), fprintf(), stderr,
36
 
                                   vfprintf() */
37
 
#include <errno.h>              /* program_invocation_short_name,
38
 
                                   errno, EACCES, ENOTDIR, ELOOP,
 
26
#define _GNU_SOURCE             /* TEMP_FAILURE_RETRY() */
 
27
#include <sys/types.h>          /* uid_t, gid_t, ssize_t */
 
28
#include <sys/stat.h>           /* mkfifo(), S_IRUSR, S_IWUSR */
 
29
#include <iso646.h>             /* and */
 
30
#include <errno.h>              /* errno, EACCES, ENOTDIR, ELOOP,
39
31
                                   ENAMETOOLONG, ENOSPC, EROFS,
40
32
                                   ENOENT, EEXIST, EFAULT, EMFILE,
41
33
                                   ENFILE, ENOMEM, EBADF, EINVAL, EIO,
42
34
                                   EISDIR, EFBIG */
43
 
#include <string.h>             /* strerror() */
44
35
#include <error.h>              /* error() */
45
 
#include <stdlib.h>             /* free(), realloc(), EXIT_SUCCESS */
46
 
#include <sys/stat.h>           /* mkfifo(), S_IRUSR, S_IWUSR */
47
 
#include <sysexits.h>           /* EX_OSFILE, EX_OSERR,
 
36
#include <stdio.h>              /* fprintf(), vfprintf(),
 
37
                                   vasprintf() */
 
38
#include <stdlib.h>             /* EXIT_FAILURE, NULL, size_t, free(),
 
39
                                   realloc(), EXIT_SUCCESS */
 
40
#include <fcntl.h>              /* open(), O_RDONLY */
 
41
#include <unistd.h>             /* read(), close(), write(),
 
42
                                   STDOUT_FILENO */
 
43
#include <sysexits.h>           /* EX_OSERR, EX_OSFILE,
48
44
                                   EX_UNAVAILABLE, EX_IOERR */
49
 
#include <fcntl.h>              /* open(), O_RDONLY */
50
 
#include <stddef.h>             /* NULL, size_t */
 
45
#include <string.h>             /* strerror() */
 
46
#include <stdarg.h>             /* va_list, va_start(), ... */
51
47
 
52
48
uid_t uid = 65534;
53
49
gid_t gid = 65534;