~ubuntu-branches/ubuntu/trusty/libpam-mount/trusty

« back to all changes in this revision

Viewing changes to .pc/pmvarrun-allow-eacces/src/pmvarrun.c

  • Committer: Package Import Robot
  • Author(s): Bastian Kleineidam
  • Date: 2011-09-08 20:10:29 UTC
  • mfrom: (1.4.12 upstream)
  • Revision ID: package-import@ubuntu.com-20110908201029-6hjjcz06by8r70p8
Tags: 2.11-1
* New upstream release.
* Removed Vcs-Git and Vcs-Browser from debian/control since they are
  supposed to include the debian/ files and not only upstream.
  (Closes: #635083)
* Suggest cifs-utils instead of smbfs. (Closes: #638155)
* Require base-files >= 6.4 since /run is used now.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
2
 *      pam_mount
3
3
 *      Copyright © W. Michael Petullo <mike@flyn.org>, 2004
4
 
 *      Copyright © Jan Engelhardt, 2005 - 2008
 
4
 *      Copyright © Jan Engelhardt, 2005-2011
5
5
 *      Copyright © Bastian Kleineidam <calvin [at] debian org>, 2005
6
6
 *
7
7
 *      This file is part of pam_mount; you can redistribute it and/or
10
10
 *      of the License, or (at your option) any later version.
11
11
 */
12
12
/*
13
 
pmvarrun.c -- Updates /var/run/pam_mount/<user>.
14
 
    A seperate program is needed so that /var/run/pam_mount/<user> may be
 
13
pmvarrun.c -- Updates /run/pam_mount/<user>.
 
14
    A seperate program is needed so that /run/pam_mount/<user> may be
15
15
    created with a pam_mount-specific security context (otherwise SELinux
16
 
    policy will conflict with gdm, which also creates files in /var/run).
 
16
    policy will conflict with whatever called pam_mount.so).
17
17
*/
18
18
 
19
19
#include <sys/stat.h>
29
29
#include <string.h>
30
30
#include <unistd.h>
31
31
#include <libHX/defs.h>
 
32
#include <libHX/io.h>
32
33
#include <libHX/string.h>
33
34
#include <pwd.h>
34
35
#include "pam_mount.h"
39
40
 
40
41
/* Definitions */
41
42
#define ASCIIZ_LLX      sizeof("0xFFFFFFFF""FFFFFFFF")
42
 
#define VAR_RUN         "/var/run"
43
 
#define VAR_RUN_PMT     VAR_RUN "/pam_mount"
 
43
#define VAR_RUN_PMT     RUNDIR "/pam_mount"
44
44
 
45
45
struct settings {
46
46
        char *user;
293
293
/**
294
294
 * create_var_run -
295
295
 *
296
 
 * Creates the /var/run/pam_mount directory required by pmvarrun and sets
 
296
 * Creates the /run/pam_mount directory required by pmvarrun and sets
297
297
 * proper permissions on it.
298
298
 *
299
299
 * Returns >0 for success or <=0 to indicate errno.
303
303
        int ret;
304
304
 
305
305
        w4rn("creating " VAR_RUN_PMT);
306
 
        if (mkdir(VAR_RUN_PMT, 0000) < 0) {
 
306
        if (HX_mkdir(VAR_RUN_PMT) < 0) {
307
307
                ret = -errno;
308
308
                l0g("unable to create " VAR_RUN_PMT ": %s\n", strerror(errno));
309
309
                return ret;