/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/plymouth.c

  • Committer: Teddy Hogeborn
  • Date: 2010-09-25 23:52:17 UTC
  • Revision ID: teddy@fukt.bsnet.se-20100925235217-4hhqfryz1ste6uw3
* mandos (ClientDBus.__init__): Bug fix: Translate "-" in client names
                                to "_" in D-Bus object paths.
  (MandosServer.handle_ipc): Bug fix: Send only address string to
                             D-Bus signal, not whole tuple.

* mandos-ctl: New options "--approve-by-default", "--deny-by-default",
              "--approval-delay", and "--approval-duration".
* mandos-ctl.xml (SYNOPSIS, OPTIONS): Document new options.

* mandos-monitor (MandosClientWidget.update): Fix spelling.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*  -*- coding: utf-8 -*- */
2
 
/*
3
 
 * Usplash - Read a password from usplash and output it
4
 
 * 
5
 
 * Copyright © 2010 Teddy Hogeborn
6
 
 * Copyright © 2010 Björn Påhlsson
7
 
 * 
8
 
 * This program is free software: you can redistribute it and/or
9
 
 * modify it under the terms of the GNU General Public License as
10
 
 * published by the Free Software Foundation, either version 3 of the
11
 
 * License, or (at your option) any later version.
12
 
 * 
13
 
 * This program is distributed in the hope that it will be useful, but
14
 
 * WITHOUT ANY WARRANTY; without even the implied warranty of
15
 
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16
 
 * General Public License for more details.
17
 
 * 
18
 
 * You should have received a copy of the GNU General Public License
19
 
 * along with this program.  If not, see
20
 
 * <http://www.gnu.org/licenses/>.
21
 
 * 
22
 
 * Contact the authors at <mandos@fukt.bsnet.se>.
23
 
 */
24
 
 
25
1
#define _GNU_SOURCE             /* asprintf(), TEMP_FAILURE_RETRY() */
26
2
#include <signal.h>             /* sig_atomic_t, struct sigaction,
27
3
                                   sigemptyset(), sigaddset(), SIGINT,
196
172
      return 0;
197
173
    }
198
174
  }
199
 
  char exe_target[sizeof(plymouthd_path)];
 
175
  char exe_target[sizeof(plymouth_path)];
200
176
  char *exe_link;
201
177
  ret = asprintf(&exe_link, "/proc/%s/exe", proc_entry->d_name);
202
178
  if(ret == -1){
223
199
  
224
200
  ssize_t sret = readlink(exe_link, exe_target, sizeof(exe_target));
225
201
  free(exe_link);
226
 
  if((sret != (ssize_t)sizeof(plymouthd_path)-1) or
227
 
      (memcmp(plymouthd_path, exe_target,
228
 
              sizeof(plymouthd_path)-1) != 0)){
 
202
  if((sret != (ssize_t)sizeof(plymouth_path)-1) or
 
203
      (memcmp(plymouth_path, exe_target,
 
204
              sizeof(plymouth_path)-1) != 0)){
229
205
    return 0;
230
206
  }
231
207
  return 1;
245
221
  if(maxvalue == 0){
246
222
    struct dirent **direntries;
247
223
    ret = scandir("/proc", &direntries, is_plymouth, alphasort);
248
 
    if (ret == -1){
249
 
      error(0, errno, "scandir");
250
 
    }
251
 
    if (ret > 0){
252
 
      ret = sscanf(direntries[0]->d_name, "%" SCNuMAX, &maxvalue);
253
 
      if (ret < 0){
254
 
        error(0, errno, "sscanf");
255
 
      }
256
 
    }
 
224
    sscanf(direntries[0]->d_name, "%" SCNuMAX, &maxvalue);
257
225
  }
258
226
  pid_t pid;
259
227
  pid = (pid_t)maxvalue;