aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2008-03-13 13:53:32 +0000
committerSergey Poznyakoff <gray@gnu.org.ua>2008-03-13 13:53:32 +0000
commit222d4ff80720206deeb8e7ee87831812628329af (patch)
treeccf4a8ed8e19e8b9b1c33b6a27cb95f51b1ec256
parentf9f6f80133f16fb1fc6c064bee5fe5c53a17c9d8 (diff)
downloadpam-modules-222d4ff80720206deeb8e7ee87831812628329af.tar.gz
pam-modules-222d4ff80720206deeb8e7ee87831812628329af.tar.bz2
* configure.ac (PAM_COMMON_INCLUDES): Add -I${top_srcdir}/lib.
(AC_OUTPUT): Add lib/Makefile. * doc/pam-modules.texi: Document `transform' option. * Make.rules: New file. * lib/mem.c, lib/slist.c, lib/log.c, lib/converse.c, lib/graypam.h, lib/Makefile.am, lib/transform.c. * pam_regex/pam_regex.c: Implement user name transformations. * pam_fshadow/Makefile.am, pam_sql/Makefile.am: Add ../lib/libgraypam.la to LDADD * pam_fshadow/pam_fshadow.c, pam_sql/pam_mysql.c, pam_sql/pam_pgsql.c, pam_sql/pam_sql.c: Use functions from ../lib. git-svn-id: file:///svnroot/pam-modules/trunk@63 56984be4-0537-0410-a56c-fcb268c96130
-rw-r--r--ChangeLog17
-rw-r--r--Make.rules26
-rw-r--r--Makefile.am5
-rw-r--r--NEWS14
-rw-r--r--common.c150
-rw-r--r--configure.ac5
-rw-r--r--doc/pam-modules.texi80
-rw-r--r--lib/Makefile.am19
-rw-r--r--lib/converse.c49
-rw-r--r--lib/graypam.h149
-rw-r--r--lib/log.c79
-rw-r--r--lib/mem.c99
-rw-r--r--lib/slist.c244
-rw-r--r--lib/transform.c533
-rw-r--r--pam_fshadow/Makefile.am15
-rw-r--r--pam_fshadow/pam_fshadow.c97
-rw-r--r--pam_log/Makefile.am15
-rw-r--r--pam_log/pam_log.c79
-rw-r--r--pam_regex/Makefile.am18
-rw-r--r--pam_regex/pam_regex.c150
-rw-r--r--pam_sql/Makefile.am3
-rw-r--r--pam_sql/pam_mysql.c15
-rw-r--r--pam_sql/pam_pgsql.c15
-rw-r--r--pam_sql/pam_sql.c79
24 files changed, 1475 insertions, 480 deletions
diff --git a/ChangeLog b/ChangeLog
index e2fb656..80ebb18 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,20 @@
12008-03-13 Sergey Poznyakoff <gray@gnu.org.ua>
2
3 * configure.ac (PAM_COMMON_INCLUDES): Add -I${top_srcdir}/lib.
4 (AC_OUTPUT): Add lib/Makefile.
5 * doc/pam-modules.texi: Document `transform' option.
6 * Make.rules: New file.
7
8 * lib/mem.c, lib/slist.c, lib/log.c, lib/converse.c,
9 lib/graypam.h, lib/Makefile.am, lib/transform.c.
10
11 * pam_regex/pam_regex.c: Implement user name transformations.
12
13 * pam_fshadow/Makefile.am, pam_sql/Makefile.am:
14 Add ../lib/libgraypam.la to LDADD
15 * pam_fshadow/pam_fshadow.c, pam_sql/pam_mysql.c,
16 pam_sql/pam_pgsql.c, pam_sql/pam_sql.c: Use functions from ../lib.
17
12007-08-28 Sergey Poznyakoff <gray@gnu.org.ua> 182007-08-28 Sergey Poznyakoff <gray@gnu.org.ua>
2 19
3 * pam_fshadow/Makefile.am, pam_regex/Makefile.am, 20 * pam_fshadow/Makefile.am, pam_regex/Makefile.am,
diff --git a/Make.rules b/Make.rules
new file mode 100644
index 0000000..ecf28eb
--- /dev/null
+++ b/Make.rules
@@ -0,0 +1,26 @@
1# Copyright (C) 2001, 2006, 2007 Sergey Poznyakoff
2#
3# This program is free software; you can redistribute it and/or modify
4# it under the terms of the GNU General Public License as published by
5# the Free Software Foundation; either version 3, or (at your option)
6# any later version.
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 along
14# with this program. If not, see <http://www.gnu.org/licenses/>.
15
16.c.lo:
17 $(LIBTOOL) --mode=compile $(CC) -c -DHAVE_CONFIG_H \
18 $(CFLAGS) $(AM_CFLAGS) $(INCLUDES) $(CPPFLAGS) \
19 $(AM_CPPFLAGS) $<
20
21.lo.la:
22 $(LIBTOOL) --mode=link $(CC) -module -export-dynamic \
23 $(AM_LDFLAGS) \
24 -o $@ $< $(AM_LDADD) $(LDADD) \
25 -rpath $(pamdir) -shared
26
diff --git a/Makefile.am b/Makefile.am
index 0434695..7885d82 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,4 +1,4 @@
1# Copyright (C) 2001, 2006 Sergey Poznyakoff 1# Copyright (C) 2001, 2006, 2008 Sergey Poznyakoff
2# 2#
3# This program is free software; you can redistribute it and/or modify 3# This program is free software; you can redistribute it and/or modify
4# it under the terms of the GNU General Public License as published by 4# it under the terms of the GNU General Public License as published by
@@ -14,5 +14,4 @@
14# with this program. If not, see <http://www.gnu.org/licenses/>. 14# with this program. If not, see <http://www.gnu.org/licenses/>.
15 15
16AUTOMAKE_OPTIONS = gnits 1.8 16AUTOMAKE_OPTIONS = gnits 1.8
17SUBDIRS = doc pam_fshadow pam_regex pam_log pam_sql 17SUBDIRS = doc lib pam_fshadow pam_regex pam_log pam_sql
18EXTRA_DIST=common.c
diff --git a/NEWS b/NEWS
index 763e42c..7b01934 100644
--- a/NEWS
+++ b/NEWS
@@ -1,12 +1,16 @@
1pam-modules -- history of user-visible changes. 2007-08-14 1pam-modules -- history of user-visible changes. 2008-03-13
2Copyright (C) 2001,2004,2005,2007 Sergey Poznyakoff 2Copyright (C) 2001,2004,2005,2007,2008 Sergey Poznyakoff
3See the end of file for copying conditions. 3See the end of file for copying conditions.
4 4
5Please send radius bug reports to <bug-pam-modules@gnu.org.ua> 5Please send radius bug reports to <bug-pam-modules@gnu.org.ua>
6 6
7Version 1.2, CVS 7Version 1.2, SVN
8 8
9Several fixes in debugging code and pam_mysql, pam_pgsql modules. 9* Several fixes in debugging code and pam_mysql, pam_pgsql modules.
10
11* pam_regex transform=expr
12
13New command line option `transform' allows to rewrite user names.
10 14
11 15
12Version 1.1, 2007-08-11 16Version 1.1, 2007-08-11
@@ -37,7 +41,7 @@ Version 0.1
37========================================================================= 41=========================================================================
38Copyright information: 42Copyright information:
39 43
40Copyright (C) 2001,2004,2005 Sergey Poznyakoff 44Copyright (C) 2001,2004,2005,2007,2008 Sergey Poznyakoff
41 45
42 Permission is granted to anyone to make or distribute verbatim copies 46 Permission is granted to anyone to make or distribute verbatim copies
43 of this document as received, in any medium, provided that the 47 of this document as received, in any medium, provided that the
diff --git a/common.c b/common.c
deleted file mode 100644
index 6004929..0000000
--- a/common.c
+++ /dev/null
@@ -1,150 +0,0 @@
1/* This file is part of pam-modules.
2 Copyright (C) 2001, 2007 Sergey Poznyakoff
3
4 This program is free software; you can redistribute it and/or modify it
5 under the terms of the GNU General Public License as published by the
6 Free Software Foundation; either version 3 of the License, or (at your
7 option) any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License along
15 with this program. If not, see <http://www.gnu.org/licenses/>. */
16
17#ifndef PAM_CONV_AGAIN
18# define PAM_CONV_AGAIN PAM_TRY_AGAIN
19#endif
20#ifndef PAM_AUTHTOK_RECOVER_ERR
21# define PAM_AUTHTOK_RECOVER_ERR PAM_AUTHTOK_RECOVERY_ERR
22#endif
23#ifndef PAM_EXTERN
24# define PAM_EXTERN
25#endif
26
27#include <regex.h>
28
29#define XSTRDUP(s) (s) ? strdup(s) : NULL
30
31#define PAM_OVERWRITE(s) \
32 do { \
33 register char *p; \
34 if ((p = s) != NULL) \
35 while (*p) *p++ = 0; \
36 } while (0)
37
38#define PAM_DROP_REPLY(reply, nrepl) \
39 do { \
40 int i; \
41 for (i=0; i<nrepl; i++) { \
42 PAM_OVERWRITE(reply[i].resp); \
43 free(reply[i].resp); \
44 } \
45 if (reply) \
46 free(reply); \
47 } while (0)
48
49static void
50_pam_delete(char *x)
51{
52 PAM_OVERWRITE(x);
53 free(x);
54}
55
56static void
57_cleanup_string(pam_handle_t *pamh, void *x, int error_status)
58{
59 _pam_delete(x);
60}
61
62static void
63_cleanup_regex(pam_handle_t *pamh, void *x, int error_status)
64{
65 regfree((regex_t*)x);
66}
67
68static void _pam_log(int err, const char *format, ...);
69
70static void
71make_str(pam_handle_t *pamh, const char *str, const char *name, char **ret)
72{
73 int retval;
74 char *newstr = XSTRDUP(str);
75
76 retval = pam_set_data(pamh, name, (void *)newstr, _cleanup_string);
77 if (retval != PAM_SUCCESS) {
78 _pam_log(LOG_CRIT,
79 "can't keep data [%s]: %s",
80 name,
81 pam_strerror(pamh, retval));
82 _pam_delete(newstr);
83 } else {
84 *ret = newstr;
85 newstr = NULL;
86 }
87}
88
89#define MAKE_STR(pamh, str, var) \
90 make_str(pamh,str,#var,&var)
91
92/* Syslog functions */
93static int syslog_dont_open = 0;
94static const char *syslog_tag = MODULE_NAME;
95static int facility = LOG_AUTHPRIV;
96
97static void