/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/askpass-fifo.c

  • Committer: Teddy Hogeborn
  • Date: 2026-05-17 23:56:03 UTC
  • Revision ID: teddy@recompile.se-20260517235603-5ygymkxkh32rxjkf
Remove white space at end of most lines

Remove white space at end of most lines.  Except for where it is
significant, like in shell script "here documents" where the delimiter
word is prefixed by "-", in block comments, and in config file example
settings.  Also not in README files, the INSTALL file, the DBUS-API
file, or the COPYING file (the last of which was copied verbatim from
FSF).

* dbus-mandos.conf: Remove white space at end of lines.
* debian/mandos-client.postinst: - '' -
* debian/mandos-client.templates: - '' -
* debian/mandos.postinst: - '' -
* dracut-module/password-agent.c: - '' -
* dracut-module/password-agent.xml: - '' -
* intro.xml: - '' -
* legalnotice.xml: - '' -
* mandos-clients.conf.xml: - '' -
* mandos-ctl.xml: - '' -
* mandos-keygen: - '' -
* mandos-keygen.xml: - '' -
* mandos-monitor.xml: - '' -
* mandos-options.xml: - '' -
* mandos.conf.xml: - '' -
* mandos.xml: - '' -
* network-hooks.d/wireless: - '' -
* plugin-helpers/mandos-client-iprouteadddel.c: - '' -
* plugin-runner.c: - '' -
* plugin-runner.xml: - '' -
* plugins.d/askpass-fifo.c: - '' -
* plugins.d/askpass-fifo.xml: - '' -
* plugins.d/mandos-client.c: - '' -
* plugins.d/mandos-client.xml: - '' -
* plugins.d/password-prompt.c: - '' -
* plugins.d/password-prompt.xml: - '' -
* plugins.d/plymouth.c: - '' -
* plugins.d/plymouth.xml: - '' -
* plugins.d/splashy.c: - '' -
* plugins.d/splashy.xml: - '' -
* plugins.d/usplash.c: - '' -
* plugins.d/usplash.xml: - '' -

Show diffs side-by-side

added added

removed removed

Lines of Context:
59
59
  va_list ap;
60
60
  char *text;
61
61
  int ret;
62
 
  
 
62
 
63
63
  va_start(ap, formatstring);
64
64
  ret = vasprintf(&text, formatstring, ap);
65
65
  if(ret == -1){
86
86
         __attribute__((unused))char **argv){
87
87
  int ret = 0;
88
88
  ssize_t sret;
89
 
  
 
89
 
90
90
  uid = getuid();
91
91
  gid = getgid();
92
 
  
 
92
 
93
93
  /* Create FIFO */
94
94
  const char passfifo[] = "/lib/cryptsetup/passfifo";
95
95
  ret = mkfifo(passfifo, S_IRUSR | S_IWUSR);
115
115
      break;                    /* not an error */
116
116
    }
117
117
  }
118
 
  
 
118
 
119
119
  /* Open FIFO */
120
120
  int fifo_fd = open(passfifo, O_RDONLY);
121
121
  if(fifo_fd == -1){
137
137
      return EX_OSFILE;
138
138
    }
139
139
  }
140
 
  
 
140
 
141
141
  /* Lower group privileges  */
142
142
  if(setgid(gid) == -1){
143
143
    error_plus(0, errno, "setgid");
144
144
  }
145
 
  
 
145
 
146
146
  /* Lower user privileges */
147
147
  if(setuid(uid) == -1){
148
148
    error_plus(0, errno, "setuid");
149
149
  }
150
 
  
 
150
 
151
151
  /* Read from FIFO */
152
152
  char *buf = NULL;
153
153
  size_t buf_len = 0;
186
186
      buf_len += (size_t)sret;
187
187
    } while(sret != 0);
188
188
  }
189
 
  
 
189
 
190
190
  /* Close FIFO */
191
191
  close(fifo_fd);
192
 
  
 
192
 
193
193
  /* Print password to stdout */
194
194
  size_t written = 0;
195
195
  while(written < buf_len){
214
214
    written += (size_t)sret;
215
215
  }
216
216
  free(buf);
217
 
  
 
217
 
218
218
  ret = close(STDOUT_FILENO);
219
219
  if(ret == -1){
220
220
    int e = errno;