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 (+124 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 = opt_set->get_opt (opt_set, "create_session")))
44
    fprintf(fp, " create-session=%s",opt);
45
  if ((opt = opt_set->get_opt (opt_set, "kill_session")))
46
    fprintf(fp, " kill-session=%s",opt);
47
  if ((opt = opt_set->get_opt (opt_set, "kill_user")))
48
    fprintf(fp, " kill-user=%s",opt);
49
  if ((opt = opt_set->get_opt (opt_set, "kill_only_users")))
50
    fprintf(fp, " kill-only-users=%s",opt);
51
  if ((opt = opt_set->get_opt (opt_set, "kill_exclude_users")))
52
    fprintf(fp, " kill-exclude-users=%s",opt);
53
  if ((opt = opt_set->get_opt (opt_set, "controllers")))
54
    fprintf(fp, " controllers=%s",opt);
55
  if ((opt = opt_set->get_opt (opt_set, "reset_controllers")))
56
    fprintf(fp, " reset-controllers=%s",opt);
57
58
  fprintf(fp, "\n");
59
  return 0;
60
61
}
62
63
static int
64
parse_config_systemd (pam_module_t *this, char *args, write_type_t type)
65
{
66
  option_set_t *opt_set = this->get_opt_set (this, type);
67
68
  if (debug)
69
    printf ("**** parse_config_%s (%s): '%s'\n", this->name,
70
	    type2string (type), args ? args : "");
71
72
  opt_set->enable (opt_set, "is_enabled", TRUE);
73
74
  while (args && strlen (args) > 0)
75
    {
76
      char *cp = strsep (&args, " \t");
77
78
      if (args)
79
	while (isspace ((int) *args))
80
	  ++args;
81
82
      if (strncmp (cp, "create-session=", 15) == 0)
83
	   opt_set->set_opt (opt_set, "create_session", strdup(&cp[15]));
84
      else if (strncmp (cp, "kill-session=", 13) == 0)
85
	   opt_set->set_opt (opt_set, "kill_session", strdup(&cp[13]));
86
      else if (strncmp (cp, "kill-user=", 10) == 0)
87
	   opt_set->set_opt (opt_set, "kill_user", strdup(&cp[10]));
88
      else if (strncmp (cp, "kill-only-users=", 16) == 0)
89
  	   opt_set->set_opt (opt_set, "kill_only_users", strdup (&cp[16]));
90
      else if (strncmp (cp, "kill-exclude-users=", 19) == 0)
91
  	   opt_set->set_opt (opt_set, "kill_exclude_users", strdup (&cp[19]));
92
      else if (strncmp (cp, "controllers=", 12) == 0)
93
  	   opt_set->set_opt (opt_set, "controllers", strdup (&cp[12]));
94
      else if (strncmp (cp, "reset-controllers=", 18) == 0)
95
  	   opt_set->set_opt (opt_set, "reset_controllers", strdup (&cp[18]));
96
      else
97
	   print_unknown_option_error ("pam_systemd.so", cp);
98
    }
99
  return 1;
100
}
101
102
GETOPT_START_1(SESSION)
103
GETOPT_END_1(SESSION)
104
105
PRINT_ARGS("systemd")
106
PRINT_XMLHELP("systemd")
107
108
/* ---- contruct module object ---- */
109
DECLARE_BOOL_OPTS_1 (is_enabled);
110
DECLARE_STRING_OPTS_7 (create_session, kill_session, kill_user, kill_only_users, kill_exclude_users, controllers, reset_controllers);
111
DECLARE_OPT_SETS;
112
113
static module_helptext_t helptext[] = {{NULL, NULL, NULL}};
114
115
116
/* at last construct the complete module object */
117
pam_module_t mod_pam_systemd = { "pam_systemd.so", opt_sets, helptext,
118
				     &parse_config_systemd,
119
				     &def_print_module,
120
				     &write_config_systemd,
121
				     &get_opt_set,
122
				     &getopt,
123
				     &print_args,
124
				     &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