/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 plugins.d/password-prompt.c

  • Committer: teddy at recompile
  • Date: 2011-12-31 13:25:58 UTC
  • mto: This revision was merged to the branch mainline in revision 541.
  • Revision ID: teddy@recompile.se-20111231132558-z0dh7qgofgctmgri
* network-hooks.s/bridge: Don't use interface names directly; search
                          for interface names using their address.
  (addrtoif): New function.
* network-hooks.s/bridge.conf (PORTS): Removed.
  (PORT_ADDRESSES): New.
* network-hooks.s/wireless: Don't use interface names directly; search
                            for interface names using their address.
  (addrtoif): New function.
* network-hooks.s/wireless.conf: Specify address.

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
/*
3
3
 * Password-prompt - Read a password from the terminal and print it
4
4
 * 
5
 
 * Copyright © 2008-2013 Teddy Hogeborn
6
 
 * Copyright © 2008-2013 Björn Påhlsson
 
5
 * Copyright © 2008-2011 Teddy Hogeborn
 
6
 * Copyright © 2008-2011 Björn Påhlsson
7
7
 * 
8
8
 * This program is free software: you can redistribute it and/or
9
9
 * modify it under the terms of the GNU General Public License as
72
72
/* Needed for conflict resolution */
73
73
const char plymouth_name[] = "plymouthd";
74
74
 
 
75
__attribute__((format (gnu_printf, 2, 3), nonnull(1)))
 
76
int fprintf_plus(FILE *stream, const char *format, ...){
 
77
  va_list ap;
 
78
  va_start (ap, format);
 
79
  
 
80
  TEMP_FAILURE_RETRY(fprintf(stream, "Mandos plugin %s: ",
 
81
                             program_invocation_short_name));
 
82
  return TEMP_FAILURE_RETRY(vfprintf(stream, format, ap));
 
83
}
 
84
 
75
85
/* Function to use when printing errors */
76
86
__attribute__((format (gnu_printf, 3, 4)))
77
87
void error_plus(int status, int errnum, const char *formatstring,
114
124
    int ret;
115
125
    int cl_fd;
116
126
    {
117
 
      uintmax_t proc_id;
 
127
      uintmax_t maxvalue;
118
128
      char *tmp;
119
129
      errno = 0;
120
 
      proc_id = strtoumax(proc_entry->d_name, &tmp, 10);
 
130
      maxvalue = strtoumax(proc_entry->d_name, &tmp, 10);
121
131
      
122
132
      if(errno != 0 or *tmp != '\0'
123
 
         or proc_id != (uintmax_t)((pid_t)proc_id)){
 
133
         or maxvalue != (uintmax_t)((pid_t)maxvalue)){
124
134
        return 0;
125
135
      }
126
136
    }
504
514
        switch(e){
505
515
        case EBADF:
506
516
          status = EX_UNAVAILABLE;
507
 
          break;
508
517
        case EIO:
509
518
        case EINVAL:
510
519
        default: