Commit Graph

41 Commits

Author SHA1 Message Date
Dag-Erling Smørgrav a9a5497d3f Reorganize:
- move libpam into lib/libpam
 - move the OATH code into lib/liboath
 - move oath.h into include/security
 - update all pointers


git-svn-id: svn+ssh://svn.openpam.org/svn/openpam/trunk@646 185d5e19-27fe-0310-9dcf-9bff6b9f3609
2013-03-05 17:49:06 +00:00
Dag-Erling Smørgrav d4aebe2ae9 Fix a boneheaded error in the option copying loop that remained undetected
through months of testing only to show up within hours of release.


git-svn-id: svn+ssh://svn.openpam.org/svn/openpam/trunk@611 185d5e19-27fe-0310-9dcf-9bff6b9f3609
2012-05-26 22:57:11 +00:00
Dag-Erling Smørgrav 56adeeabf3 umm, it's usually a good idea to test before committing.
git-svn-id: svn+ssh://svn.openpam.org/svn/openpam/trunk@601 185d5e19-27fe-0310-9dcf-9bff6b9f3609
2012-04-14 20:37:45 +00:00
Dag-Erling Smørgrav 7ca68ffaec Separate the code that opens and validates the policy file from the code
that searches for it.  If the service name contains a path separator
character, treat it is a relative or absolute path to the policy file.

This need to be documented either in pam.conf(5) or in pam_start(3) once
the feature mechanism is no longer experimental.


git-svn-id: svn+ssh://svn.openpam.org/svn/openpam/trunk@600 185d5e19-27fe-0310-9dcf-9bff6b9f3609
2012-04-14 16:11:39 +00:00
Dag-Erling Smørgrav 312b5753a5 Add an experimental mechanism for enabling / disabling optional features.
Use it to control policy and module file checks.  The default settings
correspond to the current behavior: disallow path separators in policy
names, but allow them in module names; verify ownership and permissions
for both policy files and modules.


git-svn-id: svn+ssh://svn.openpam.org/svn/openpam/trunk@594 185d5e19-27fe-0310-9dcf-9bff6b9f3609
2012-04-14 14:18:41 +00:00
Dag-Erling Smørgrav 31950458f5 Add strlcat() for non-BSD systems.
strlcpy() needs to be static.


git-svn-id: svn+ssh://svn.openpam.org/svn/openpam/trunk@554 185d5e19-27fe-0310-9dcf-9bff6b9f3609
2012-04-02 09:46:48 +00:00
Dag-Erling Smørgrav 96357f3c52 Add an openpam_straddch() function that appends a character to a
string, reallocating the string if necessary.

Add an openpam_readword() function that reads a single word from a
file according to the usual shell quoting rules.

Add an openpam_readlinev() function that uses openpam_readword() to
read an entire line and return a list of the words it contained.

Rewrite openpam_parse_chain() using openpam_readlinev(), which greatly
simplifies the code and ensures correct parsing of module option.

Thanks to Maëlle Lesage for pointing out the issue and writing an
early version of what became the main loop in openpam_readword().


git-svn-id: svn+ssh://svn.openpam.org/svn/openpam/trunk@547 185d5e19-27fe-0310-9dcf-9bff6b9f3609
2012-04-01 15:01:21 +00:00
Dag-Erling Smørgrav c3d9f63b55 Fix a regression introduced by r487. The count was actually used to
determine whether to stop searching for a policy.  After r487,
multiple policies for the same service would be concatenated, whereas
the intention was that the one that came first in the policy path
should eclipse the others.

While there, take the time to reorganize the front end of the policy
loading code, both to clarify the logic and to produce better log
messages in case of errors.  The most important change is that
openpam_load_chain() now opens and vets the policy file before calling
openpam_parse_chain(), so it is better able to distinguish between
errors relating to the file itself and errors relating to its
contents.


git-svn-id: svn+ssh://svn.openpam.org/svn/openpam/trunk@524 185d5e19-27fe-0310-9dcf-9bff6b9f3609
2012-01-11 00:29:48 +00:00
Dag-Erling Smørgrav 229c006c86 Forgotten in previous commit: check the ownership and permissions of the
policy file.


git-svn-id: svn+ssh://svn.openpam.org/svn/openpam/trunk@500 185d5e19-27fe-0310-9dcf-9bff6b9f3609
2011-11-22 12:07:03 +00:00
Dag-Erling Smørgrav b9f0b632da Validate the service name, closing an attack vector for programs like
kcheckpass that let the user specify which policy to apply.  See
<URL:http://c-skills.blogspot.com/2011/11/openpam-trickery.html>.


git-svn-id: svn+ssh://svn.openpam.org/svn/openpam/trunk@497 185d5e19-27fe-0310-9dcf-9bff6b9f3609
2011-11-21 16:25:49 +00:00
Dag-Erling Smørgrav 6a92548403 Reorganize the headers and centralize the string tables.
git-svn-id: svn+ssh://svn.openpam.org/svn/openpam/trunk@491 185d5e19-27fe-0310-9dcf-9bff6b9f3609
2011-11-12 00:12:32 +00:00
Dag-Erling Smørgrav e8522c7fcc Always create optv, even if there are no options.
git-svn-id: svn+ssh://svn.openpam.org/svn/openpam/trunk@488 185d5e19-27fe-0310-9dcf-9bff6b9f3609
2011-11-05 20:50:15 +00:00
Dag-Erling Smørgrav c86a681052 The count was never used, so ditch it and return plain PAM error codes
instead.


git-svn-id: svn+ssh://svn.openpam.org/svn/openpam/trunk@487 185d5e19-27fe-0310-9dcf-9bff6b9f3609
2011-11-05 20:00:46 +00:00
Dag-Erling Smørgrav ba7de9c9c6 Remove debugging code.
git-svn-id: svn+ssh://svn.openpam.org/svn/openpam/trunk@484 185d5e19-27fe-0310-9dcf-9bff6b9f3609
2011-11-03 16:47:26 +00:00
Dag-Erling Smørgrav 493804d19b Fix a couple of bugs in the option string reassembly code.
git-svn-id: svn+ssh://svn.openpam.org/svn/openpam/trunk@483 185d5e19-27fe-0310-9dcf-9bff6b9f3609
2011-11-03 16:46:20 +00:00
Dag-Erling Smørgrav 6835696a2a Revert large parts of r478. I had forgotten that the module arguments
are actually passed to each service function in the classic (argc,
argv) form.  The only place where the compiler could have caught this
used a type cast, and it did not show up in testing either because all
of the modules I tested use openpam_get_option(3) instead of
manipulating argv directly.

The cleaned-up policy parsing code remains in place, but options are
once more stored as strings, pretty much the way they appear in the
policy file, except that quotes are stripped.


git-svn-id: svn+ssh://svn.openpam.org/svn/openpam/trunk@482 185d5e19-27fe-0310-9dcf-9bff6b9f3609
2011-11-03 16:33:02 +00:00
Dag-Erling Smørgrav c16faba34e The include directive expects a service name, not a filename.
While there, remember to check for trailing garbage.


git-svn-id: svn+ssh://svn.openpam.org/svn/openpam/trunk@481 185d5e19-27fe-0310-9dcf-9bff6b9f3609
2011-11-03 16:09:22 +00:00
Dag-Erling Smørgrav 55f6a50684 Major overhaul of the policy parser to support quoted option values. As a
bonus, it should now be much easier to read and understand.

This also changes the way options are stored: they are now stored as a list
of { key, value } pairs rather than "key=value" strings.


git-svn-id: svn+ssh://svn.openpam.org/svn/openpam/trunk@478 185d5e19-27fe-0310-9dcf-9bff6b9f3609
2011-11-03 15:39:18 +00:00
Dag-Erling Smørgrav f229d69d05 Fix the case where match_word() matches the last word on the line. It
would previously return 0 because it expected the next character after
the matched word to be a space.


git-svn-id: svn+ssh://svn.openpam.org/svn/openpam/trunk@474 185d5e19-27fe-0310-9dcf-9bff6b9f3609
2011-11-03 10:56:10 +00:00
Dag-Erling Smørgrav 0eae3f21c1 Fix namespace violations in some symbols which have external linkage but
are not part of the API.


git-svn-id: svn+ssh://svn.openpam.org/svn/openpam/trunk@460 185d5e19-27fe-0310-9dcf-9bff6b9f3609
2011-11-02 13:56:03 +00:00
Dag-Erling Smørgrav 16844f8456 Update copyright and release notes.
git-svn-id: svn+ssh://svn.openpam.org/svn/openpam/trunk@437 185d5e19-27fe-0310-9dcf-9bff6b9f3609
2011-09-13 12:00:13 +00:00
Dag-Erling Smørgrav b4871fa6dc Update copyright dates.
git-svn-id: svn+ssh://svn.openpam.org/svn/openpam/trunk@435 185d5e19-27fe-0310-9dcf-9bff6b9f3609
2010-03-10 11:38:49 +00:00
Dag-Erling Smørgrav 1f70254313 Fix double-UTF
git-svn-id: svn+ssh://svn.openpam.org/svn/openpam/trunk@423 185d5e19-27fe-0310-9dcf-9bff6b9f3609
2009-10-29 17:08:38 +00:00
Dag-Erling Smørgrav e9776bfa73 Convert everything to UTF-8.
git-svn-id: svn+ssh://svn.openpam.org/svn/openpam/trunk@422 185d5e19-27fe-0310-9dcf-9bff6b9f3609
2009-10-18 22:19:57 +00:00
Dag-Erling Smørgrav 5a523baf2b Update copyright
git-svn-id: svn+ssh://svn.openpam.org/svn/openpam/trunk@420 185d5e19-27fe-0310-9dcf-9bff6b9f3609
2009-06-12 19:12:42 +00:00
Dag-Erling Smørgrav d8194fe11a Indentation nits
git-svn-id: svn+ssh://svn.openpam.org/svn/openpam/trunk@419 185d5e19-27fe-0310-9dcf-9bff6b9f3609
2008-12-22 14:55:47 +00:00
Dag-Erling Smørgrav 9f0d6d6267 Update copyright, and coincidentially root out the last remaining vestige
of iso-8859-1 in favor of utf-8.


git-svn-id: svn+ssh://svn.openpam.org/svn/openpam/trunk@417 185d5e19-27fe-0310-9dcf-9bff6b9f3609
2008-02-14 18:36:22 +00:00
Dag-Erling Smørgrav ba75190ad0 Convert to correct config.h idiom. We must include it before any other
header, as it may define symbols which modify the behaviour of those headers.


git-svn-id: svn+ssh://svn.openpam.org/svn/openpam/trunk@416 185d5e19-27fe-0310-9dcf-9bff6b9f3609
2008-02-14 18:33:24 +00:00
Dag-Erling Smørgrav fd5e5d917d Update copyright.
git-svn-id: svn+ssh://svn.openpam.org/svn/openpam/trunk@408 185d5e19-27fe-0310-9dcf-9bff6b9f3609
2007-12-21 11:36:24 +00:00
Dag-Erling Smørgrav ce5921ba4c Convert $P4$ tags to $Id$.
git-svn-id: svn+ssh://svn.openpam.org/svn/openpam/trunk@320 185d5e19-27fe-0310-9dcf-9bff6b9f3609
2006-02-16 20:33:19 +00:00
Dag-Erling Smørgrav c25cf2c668 Remove debugging output.
git-svn-id: svn+ssh://svn.openpam.org/svn/openpam/trunk@248 185d5e19-27fe-0310-9dcf-9bff6b9f3609
2003-06-02 17:03:15 +00:00
Dag-Erling Smørgrav 044448812b Incorporate patches from Dmitry V. Levin which improve the policy
loader, reducing the number of times each file is read.  Also fix
a few minor nits (such as making facility names and control flags
case insensitive like they are in Solaris).


git-svn-id: svn+ssh://svn.openpam.org/svn/openpam/trunk@243 185d5e19-27fe-0310-9dcf-9bff6b9f3609
2003-06-01 14:23:25 +00:00
Dag-Erling Smørgrav 6c68711fe1 Continue improving the new configuration parser, particularly error
reporting: error messages relating to policy files now include line
numbers, and the parser will warn about invalid facility names.

Also fix an off-by-one bug in the option handling code.


git-svn-id: svn+ssh://svn.openpam.org/svn/openpam/trunk@241 185d5e19-27fe-0310-9dcf-9bff6b9f3609
2003-05-26 15:31:28 +00:00
Dag-Erling Smørgrav 0fe6f41f7c Overhaul the configuration parser. This adds support for continuation
lines and policy inclusion.


git-svn-id: svn+ssh://svn.openpam.org/svn/openpam/trunk@240 185d5e19-27fe-0310-9dcf-9bff6b9f3609
2003-05-25 18:34:31 +00:00
Dag-Erling Smørgrav 570d0c7751 With one single exception (where the pointer is obviously being
immediately overwritten), replace all use of free(3) with a macro
that clears the pointer after freeing the memory it pointed to.

Suggested by:	Dmitry V. Levin <ldv@altlinux.org>


git-svn-id: svn+ssh://svn.openpam.org/svn/openpam/trunk@232 185d5e19-27fe-0310-9dcf-9bff6b9f3609
2003-05-24 19:44:29 +00:00
Dag-Erling Smørgrav 1d796b814b Support /usr/local/etc/pam.conf, for completeness' sake.
Sponsored by:	DARPA, NAI Labs


git-svn-id: svn+ssh://svn.openpam.org/svn/openpam/trunk@174 185d5e19-27fe-0310-9dcf-9bff6b9f3609
2002-10-28 13:39:45 +00:00
Dag-Erling Smørgrav a9b8bb1e92 Implement the "binding" control flag (from Solaris 9)
Sponsored by:	DARPA, NAI Labs


git-svn-id: svn+ssh://svn.openpam.org/svn/openpam/trunk@161 185d5e19-27fe-0310-9dcf-9bff6b9f3609
2002-06-30 22:41:59 +00:00
Dag-Erling Smørgrav ed3d5a8522 DBA update and minor whitespace fixes.
git-svn-id: svn+ssh://svn.openpam.org/svn/openpam/trunk@157 185d5e19-27fe-0310-9dcf-9bff6b9f3609
2002-06-07 18:22:57 +00:00
Dag-Erling Smørgrav 082364c255 Initialize other to all-zeroes before using it.
git-svn-id: svn+ssh://svn.openpam.org/svn/openpam/trunk@142 185d5e19-27fe-0310-9dcf-9bff6b9f3609
2002-05-03 14:55:03 +00:00
Dag-Erling Smørgrav 472018b4e5 Fall in line with Solaris and Linux-PAM wrt use of the "other" policy:
use it to fill the gaps in incomplete policies as well as to replace
missing ones.

Sponsored by:	DARPA, NAI Labs


git-svn-id: svn+ssh://svn.openpam.org/svn/openpam/trunk@137 185d5e19-27fe-0310-9dcf-9bff6b9f3609
2002-05-02 06:08:02 +00:00
Dag-Erling Smørgrav 2b0fbefd4a Move the policy-loading code into a separate file.
Sponsored by:	DARPA, NAI Labs


git-svn-id: svn+ssh://svn.openpam.org/svn/openpam/trunk@112 185d5e19-27fe-0310-9dcf-9bff6b9f3609
2002-04-12 20:27:47 +00:00