summaryrefslogtreecommitdiff
path: root/libpam
diff options
context:
space:
mode:
authorThorsten Kukuk <kukuk@thkukuk.de>2006-06-14 11:41:47 +0000
committerThorsten Kukuk <kukuk@thkukuk.de>2006-06-14 11:41:47 +0000
commit1b8c3c439aca2b3849328666a0d022c1685b7bdf (patch)
tree46ff54f2f66d5b7a5cccbae209940f49dd5e2745 /libpam
parent7c4418f0d3ed9388713bee5ec7aff54a02a9796c (diff)
Relevant BUGIDs:
Purpose of commit: cleanup Commit summary: --------------- 2006-06-14 Thorsten Kukuk <kukuk@thkukuk.de> * libpam/pam_handlers.c (extract_modulename): Use _pam_strdup instead of strdup. * libpam/pam_private.h: Remove _pam_strCMP. * libpam/pam_misc.c: Likewise. * libpam/pam_handlers.c: Replaced _pam_strCMP with strcasecmp.
Diffstat (limited to 'libpam')
-rw-r--r--libpam/Makefile.am2
-rw-r--r--libpam/pam_handlers.c24
-rw-r--r--libpam/pam_misc.c52
-rw-r--r--libpam/pam_private.h3
4 files changed, 48 insertions, 33 deletions
diff --git a/libpam/Makefile.am b/libpam/Makefile.am
index 4648908b..a137a242 100644
--- a/libpam/Makefile.am
+++ b/libpam/Makefile.am
@@ -2,7 +2,7 @@
# Copyright (c) 2005, 2006 Thorsten Kukuk <kukuk@suse.de>
#
-AM_CFLAGS = -DDEFAULT_MODULE_PATH=\"$(SECUREDIR)/\" -DLIBPAM_COMPILE \
+AM_CFLAGS = -DDEFAULT_MODULE_PATH=\"$(SECUREDIR)/\" -DLIBPAM_COMPILE -Werror \
-I$(srcdir)/include $(LIBPRELUDE_CFLAGS) -DPAM_VERSION=\"$(VERSION)\"
if HAVE_LIBSELINUX
AM_CFLAGS += -D"WITH_SELINUX"
diff --git a/libpam/pam_handlers.c b/libpam/pam_handlers.c
index 62342fda..87d781d2 100644
--- a/libpam/pam_handlers.c
+++ b/libpam/pam_handlers.c
@@ -87,10 +87,10 @@ static int _pam_parse_conf_file(pam_handle_t *pamh, FILE *f
other = 0;
else
#endif /* PAM_READ_BOTH_CONFS */
- other = !_pam_strCMP(this_service, PAM_DEFAULT_SERVICE);
+ other = !strcasecmp(this_service, PAM_DEFAULT_SERVICE);
/* accept "service name" or PAM_DEFAULT_SERVICE modules */
- if (!_pam_strCMP(this_service, pamh->service_name) || other) {
+ if (!strcasecmp(this_service, pamh->service_name) || other) {
int pam_include = 0;
/* This is a service we are looking for */
@@ -106,13 +106,13 @@ static int _pam_parse_conf_file(pam_handle_t *pamh, FILE *f
module_type = (requested_module_type != PAM_T_ANY) ?
requested_module_type : PAM_T_AUTH; /* most sensitive */
must_fail = 1; /* install as normal but fail when dispatched */
- } else if (!_pam_strCMP("auth", tok)) {
+ } else if (!strcasecmp("auth", tok)) {
module_type = PAM_T_AUTH;
- } else if (!_pam_strCMP("session", tok)) {
+ } else if (!strcasecmp("session", tok)) {
module_type = PAM_T_SESS;
- } else if (!_pam_strCMP("account", tok)) {
+ } else if (!strcasecmp("account", tok)) {
module_type = PAM_T_ACCT;
- } else if (!_pam_strCMP("password", tok)) {
+ } else if (!strcasecmp("password", tok)) {
module_type = PAM_T_PASS;
} else {
/* Illegal module type */
@@ -146,29 +146,29 @@ static int _pam_parse_conf_file(pam_handle_t *pamh, FILE *f
"(%s) no control flag supplied", this_service);
_pam_set_default_control(actions, _PAM_ACTION_BAD);
must_fail = 1;
- } else if (!_pam_strCMP("required", tok)) {
+ } else if (!strcasecmp("required", tok)) {
D(("*PAM_F_REQUIRED*"));
actions[PAM_SUCCESS] = _PAM_ACTION_OK;
actions[PAM_NEW_AUTHTOK_REQD] = _PAM_ACTION_OK;
actions[PAM_IGNORE] = _PAM_ACTION_IGNORE;
_pam_set_default_control(actions, _PAM_ACTION_BAD);
- } else if (!_pam_strCMP("requisite", tok)) {
+ } else if (!strcasecmp("requisite", tok)) {
D(("*PAM_F_REQUISITE*"));
actions[PAM_SUCCESS] = _PAM_ACTION_OK;
actions[PAM_NEW_AUTHTOK_REQD] = _PAM_ACTION_OK;
actions[PAM_IGNORE] = _PAM_ACTION_IGNORE;
_pam_set_default_control(actions, _PAM_ACTION_DIE);
- } else if (!_pam_strCMP("optional", tok)) {
+ } else if (!strcasecmp("optional", tok)) {
D(("*PAM_F_OPTIONAL*"));
actions[PAM_SUCCESS] = _PAM_ACTION_OK;
actions[PAM_NEW_AUTHTOK_REQD] = _PAM_ACTION_OK;
_pam_set_default_control(actions, _PAM_ACTION_IGNORE);
- } else if (!_pam_strCMP("sufficient", tok)) {
+ } else if (!strcasecmp("sufficient", tok)) {
D(("*PAM_F_SUFFICIENT*"));
actions[PAM_SUCCESS] = _PAM_ACTION_DONE;
actions[PAM_NEW_AUTHTOK_REQD] = _PAM_ACTION_DONE;
_pam_set_default_control(actions, _PAM_ACTION_IGNORE);
- } else if (!_pam_strCMP("include", tok)) {
+ } else if (!strcasecmp("include", tok)) {
D(("*PAM_F_INCLUDE*"));
pam_include = 1;
} else {
@@ -571,7 +571,7 @@ extract_modulename(const char *mod_path)
else
p++;
- if ((retval = strdup (p)) == NULL)
+ if ((retval = _pam_strdup (p)) == NULL)
return NULL;
dot = strrchr (retval, '.');
diff --git a/libpam/pam_misc.c b/libpam/pam_misc.c
index 26590d09..78e317f7 100644
--- a/libpam/pam_misc.c
+++ b/libpam/pam_misc.c
@@ -1,7 +1,38 @@
-/* pam_misc.c -- This is random stuff */
-
-/*
- * $Id$
+/* pam_misc.c -- This is random stuff
+ *
+ * Copyright (c) Andrew G. Morgan <morgan@kernel.org> 2000-2003
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, and the entire permission notice in its entirety,
+ * including the disclaimer of warranties.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote
+ * products derived from this software without specific prior
+ * written permission.
+ *
+ * ALTERNATIVELY, this product may be distributed under the terms of
+ * the GNU Public License, in which case the provisions of the GPL are
+ * required INSTEAD OF the above restrictions. (This clause is
+ * necessary due to a potential bad interaction between the GPL and
+ * the restrictions contained in a BSD-style copyright.)
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "pam_private.h"
@@ -13,19 +44,6 @@
#include <syslog.h>
#include <ctype.h>
-/* caseless string comparison: POSIX does not define this.. */
-int _pam_strCMP(const char *s, const char *t)
-{
- int cf;
-
- do {
- cf = tolower(*s) - tolower(*t);
- ++t;
- } while (!cf && *s++);
-
- return cf;
-}
-
char *_pam_StrTok(char *from, const char *format, char **next)
/*
* this function is a variant of the standard strtok, it differs in that
diff --git a/libpam/pam_private.h b/libpam/pam_private.h
index ad804791..8b2cf92c 100644
--- a/libpam/pam_private.h
+++ b/libpam/pam_private.h
@@ -1,8 +1,6 @@
/*
* pam_private.h
*
- * $Id$
- *
* This is the Linux-PAM Library Private Header. It contains things
* internal to the Linux-PAM library. Things not needed by either an
* application or module.
@@ -251,7 +249,6 @@ struct pam_data {
void _pam_free_data(pam_handle_t *pamh, int status);
-int _pam_strCMP(const char *s, const char *t);
char *_pam_StrTok(char *from, const char *format, char **next);
char *_pam_strdup(const char *s);