View | Details | Raw Unified | Return to bug 700053
Collapse All | Expand All

(-)pam-config-0.79/src/Makefile.am (-1 / +1 lines)
Lines 30-36 pam_config_SOURCES = pam-config.c load_c Link Here
30
	mod_pam_group.c mod_pam_time.c mod_pam_ssh.c mod_pam_succeed_if.c \
30
	mod_pam_group.c mod_pam_time.c mod_pam_ssh.c mod_pam_succeed_if.c \
31
	mod_pam_csync.c mod_pam_fp.c mod_pam_fprint.c mod_pam_pwhistory.c \
31
	mod_pam_csync.c mod_pam_fp.c mod_pam_fprint.c mod_pam_pwhistory.c \
32
	mod_pam_selinux.c mod_pam_gnome_keyring.c mod_pam_passwdqc.c \
32
	mod_pam_selinux.c mod_pam_gnome_keyring.c mod_pam_passwdqc.c \
33
	mod_pam_exec.c mod_pam_sss.c mod_pam_fprintd.c
33
	mod_pam_exec.c mod_pam_sss.c mod_pam_fprintd.c mod_pam_systemd.c
34
34
35
noinst_HEADERS = pam-config.h pam-module.h
35
noinst_HEADERS = pam-config.h pam-module.h
36
36
(-)pam-config-0.79/src/mod_pam_systemd.c (+120 lines)
Line 0 Link Here
1
/* Copyright (C) 2011 Frederic Crozat
2
   Author: Frederic Crozat <fcrozat@suse.com>
3
4
   This program is free software; you can redistribute it and/or modify
5
   it under the terms of the GNU General Public License version 2 as
6
   published by the Free Software Foundation.
7
8
   This program is distributed in the hope that it will be useful,
9
   but WITHOUT ANY WARRANTY; without even the implied warranty of
10
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11
   GNU General Public License for more details.
12
13
   You should have received a copy of the GNU General Public License
14
   along with this program; if not, write to the Free Software Foundation,
15
   Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
16
17
#ifdef HAVE_CONFIG_H
18
#include <config.h>
19
#endif
20
21
#include <stdio.h>
22
#include <string.h>
23
#include <ctype.h>
24
#include <stdlib.h>
25
26
#include "pam-config.h"
27
#include "pam-module.h"
28
29
static int
30
write_config_systemd (pam_module_t *this, enum write_type op, FILE *fp)
31
{
32
  option_set_t *opt_set = this->get_opt_set (this, op);
33
  char *opt;
34
35
  if (debug)
36
    debug_write_call (this, op);
37
38
  if (op != SESSION || !opt_set->is_enabled (opt_set, "is_enabled"))
39
    return 0;
40
41
  fprintf (fp, "session\toptional\tpam_systemd.so");
42
43
  if (opt_set->is_enabled (opt_set, "debug"))
44
    fprintf(fp, " debug");
45
  if ((opt = opt_set->get_opt (opt_set, "kill_session_processes")))
46
    fprintf(fp, " kill-session-processes=%s",opt);
47
  if ((opt = opt_set->get_opt (opt_set, "kill_only_users")))
48
    fprintf(fp, " kill-only-users=%s",opt);
49
  if ((opt = opt_set->get_opt (opt_set, "kill_exclude_users")))
50
    fprintf(fp, " kill-exclude-users=%s",opt);
51
  if ((opt = opt_set->get_opt (opt_set, "controllers")))
52
    fprintf(fp, " controllers=%s",opt);
53
  if ((opt = opt_set->get_opt (opt_set, "reset_controllers")))
54
    fprintf(fp, " reset-controllers=%s",opt);
55
56
  fprintf(fp, "\n");
57
  return 0;
58
59
}
60
61
static int
62
parse_config_systemd (pam_module_t *this, char *args, write_type_t type)
63
{
64
  option_set_t *opt_set = this->get_opt_set (this, type);
65
66
  if (debug)
67
    printf ("**** parse_config_%s (%s): '%s'\n", this->name,
68
	    type2string (type), args ? args : "");
69
70
  opt_set->enable (opt_set, "is_enabled", TRUE);
71
72
  while (args && strlen (args) > 0)
73
    {
74
      char *cp = strsep (&args, " \t");
75
76
      if (args)
77
	while (isspace ((int) *args))
78
	  ++args;
79
80
      if (strcmp (cp, "debug") == 0)
81
	   opt_set->enable (opt_set, "debug", TRUE);
82
      else if (strncmp (cp, "kill-session-processes=", 13) == 0)
83
	   opt_set->set_opt (opt_set, "kill_session_processes", strdup(&cp[13]));
84
      else if (strncmp (cp, "kill-only-users=", 16) == 0)
85
  	   opt_set->set_opt (opt_set, "kill_only_users", strdup (&cp[16]));
86
      else if (strncmp (cp, "kill-exclude-users=", 19) == 0)
87
  	   opt_set->set_opt (opt_set, "kill_exclude_users", strdup (&cp[19]));
88
      else if (strncmp (cp, "controllers=", 12) == 0)
89
  	   opt_set->set_opt (opt_set, "controllers", strdup (&cp[12]));
90
      else if (strncmp (cp, "reset-controllers=", 18) == 0)
91
  	   opt_set->set_opt (opt_set, "reset_controllers", strdup (&cp[18]));
92
      else
93
	   print_unknown_option_error ("pam_systemd.so", cp);
94
    }
95
  return 1;
96
}
97
98
GETOPT_START_1(SESSION)
99
GETOPT_END_1(SESSION)
100
101
PRINT_ARGS("systemd")
102
PRINT_XMLHELP("systemd")
103
104
/* ---- contruct module object ---- */
105
DECLARE_BOOL_OPTS_2 (is_enabled, debug);
106
DECLARE_STRING_OPTS_5 (kill_session_processes, kill_only_users, kill_exclude_users, controllers, reset_controllers);
107
DECLARE_OPT_SETS;
108
109
static module_helptext_t helptext[] = {{NULL, NULL, NULL}};
110
111
112
/* at last construct the complete module object */
113
pam_module_t mod_pam_systemd = { "pam_systemd.so", opt_sets, helptext,
114
				     &parse_config_systemd,
115
				     &def_print_module,
116
				     &write_config_systemd,
117
				     &get_opt_set,
118
				     &getopt,
119
				     &print_args,
120
				     &print_xmlhelp};
(-)pam-config-0.79/src/supported-modules.h (+3 lines)
Lines 39-44 extern pam_module_t mod_pam_cryptpass; Link Here
39
extern pam_module_t mod_pam_csync;
39
extern pam_module_t mod_pam_csync;
40
extern pam_module_t mod_pam_loginuid;
40
extern pam_module_t mod_pam_loginuid;
41
extern pam_module_t mod_pam_mount;
41
extern pam_module_t mod_pam_mount;
42
extern pam_module_t mod_pam_systemd;
42
43
43
pam_module_t *common_module_list[] = {
44
pam_module_t *common_module_list[] = {
44
  &mod_pam_apparmor,
45
  &mod_pam_apparmor,
Lines 67-72 pam_module_t *common_module_list[] = { Link Here
67
  &mod_pam_ssh,
68
  &mod_pam_ssh,
68
  &mod_pam_sss,
69
  &mod_pam_sss,
69
  &mod_pam_succeed_if,
70
  &mod_pam_succeed_if,
71
  &mod_pam_systemd,
70
  &mod_pam_thinkfinger,
72
  &mod_pam_thinkfinger,
71
  &mod_pam_umask,
73
  &mod_pam_umask,
72
  &mod_pam_unix,
74
  &mod_pam_unix,
Lines 143-148 static pam_module_t *module_list_session Link Here
143
  &mod_pam_nam,
145
  &mod_pam_nam,
144
  &mod_pam_umask,
146
  &mod_pam_umask,
145
  &mod_pam_ssh,
147
  &mod_pam_ssh,
148
  &mod_pam_systemd,
146
  &mod_pam_selinux,
149
  &mod_pam_selinux,
147
  &mod_pam_gnome_keyring,
150
  &mod_pam_gnome_keyring,
148
  &mod_pam_exec,
151
  &mod_pam_exec,

Return to bug 700053