Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/external/bsd/openpam lint and static module fixes
details: https://anonhg.NetBSD.org/src/rev/510efb798d51
branches: trunk
changeset: 772240:510efb798d51
user: christos <christos%NetBSD.org@localhost>
date: Sun Dec 25 23:18:56 2011 +0000
description:
lint and static module fixes
diffstat:
external/bsd/openpam/dist/include/security/openpam.h | 9 +-
external/bsd/openpam/dist/lib/openpam_check_owner_perms.c | 5 +-
external/bsd/openpam/dist/lib/openpam_configure.c | 21 +-
external/bsd/openpam/dist/lib/openpam_dispatch.c | 4 +-
external/bsd/openpam/dist/lib/pam_set_item.c | 5 +-
external/bsd/openpam/openpam2netbsd | 107 ++++++++++++++
6 files changed, 129 insertions(+), 22 deletions(-)
diffs (290 lines):
diff -r f568809b4191 -r 510efb798d51 external/bsd/openpam/dist/include/security/openpam.h
--- a/external/bsd/openpam/dist/include/security/openpam.h Sun Dec 25 23:18:25 2011 +0000
+++ b/external/bsd/openpam/dist/include/security/openpam.h Sun Dec 25 23:18:56 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: openpam.h,v 1.2 2011/12/25 22:27:55 christos Exp $ */
+/* $NetBSD: openpam.h,v 1.3 2011/12/25 23:18:56 christos Exp $ */
/*-
* Copyright (c) 2002-2003 Networks Associates Technology, Inc.
@@ -321,11 +321,7 @@
# define PAM_SOEXT ".so"
#endif
-#if defined(OPENPAM_STATIC_MODULES)
-# if !defined(__GNUC__)
-# error "Don't know how to build static modules on non-GNU compilers"
-# endif
-/* gcc, static linking */
+#if (defined(__GNUC__) || defined(__PCC__)) && !defined(NO_STATIC_MODULES)
# include <sys/cdefs.h>
# ifdef __FreeBSD__
# include <linker_set.h>
@@ -335,6 +331,7 @@
# define SET_DECLARE(a, b) __link_set_decl(a, b)
# define SET_FOREACH(a, b) __link_set_foreach(a, b)
# endif
+# define OPENPAM_STATIC_MODULES
# define PAM_EXTERN static
# define PAM_MODULE_ENTRY(name) \
static char _pam_name[] = name PAM_SOEXT; \
diff -r f568809b4191 -r 510efb798d51 external/bsd/openpam/dist/lib/openpam_check_owner_perms.c
--- a/external/bsd/openpam/dist/lib/openpam_check_owner_perms.c Sun Dec 25 23:18:25 2011 +0000
+++ b/external/bsd/openpam/dist/lib/openpam_check_owner_perms.c Sun Dec 25 23:18:56 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: openpam_check_owner_perms.c,v 1.2 2011/12/25 22:27:55 christos Exp $ */
+/* $NetBSD: openpam_check_owner_perms.c,v 1.3 2011/12/25 23:18:56 christos Exp $ */
/*-
* Copyright (c) 2011 Dag-Erling Smørgrav
@@ -97,7 +97,8 @@
uid_t root, arbitrator;
char pathbuf[PATH_MAX];
struct stat sb;
- int len, serrno;
+ size_t len;
+ int serrno;
root = 0;
arbitrator = geteuid();
diff -r f568809b4191 -r 510efb798d51 external/bsd/openpam/dist/lib/openpam_configure.c
--- a/external/bsd/openpam/dist/lib/openpam_configure.c Sun Dec 25 23:18:25 2011 +0000
+++ b/external/bsd/openpam/dist/lib/openpam_configure.c Sun Dec 25 23:18:56 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: openpam_configure.c,v 1.2 2011/12/25 22:27:55 christos Exp $ */
+/* $NetBSD: openpam_configure.c,v 1.3 2011/12/25 23:18:56 christos Exp $ */
/*-
* Copyright (c) 2001-2003 Networks Associates Technology, Inc.
@@ -94,7 +94,7 @@
* Allowed characters are all characters in the POSIX portable filename
* character set.
*/
-static int
+static size_t
parse_service_name(char **line, char **service)
{
char *b, *e;
@@ -144,7 +144,7 @@
if (e == b)
return ((pam_facility_t)-1);
for (i = 0; i < PAM_NUM_FACILITIES; ++i)
- if (strlcmp(pam_facility_name[i], b, e - b) == 0)
+ if (strlcmp(pam_facility_name[i], b, (size_t)(e - b)) == 0)
break;
if (i == PAM_NUM_FACILITIES)
return ((pam_facility_t)-1);
@@ -174,7 +174,7 @@
/* nothing */ ;
if (e == b)
return (0);
- if (strlcmp("include", b, e - b) != 0)
+ if (strlcmp("include", b, (size_t)(e - b)) != 0)
return (0);
*line = e;
return (1);
@@ -209,7 +209,7 @@
if (e == b)
return ((pam_control_t)-1);
for (i = 0; i < PAM_NUM_CONTROL_FLAGS; ++i)
- if (strlcmp(pam_control_flag_name[i], b, e - b) == 0)
+ if (strlcmp(pam_control_flag_name[i], b, (size_t)(e - b)) == 0)
break;
if (i == PAM_NUM_CONTROL_FLAGS)
return ((pam_control_t)-1);
@@ -232,7 +232,7 @@
* Allowed characters are all characters in the POSIX portable filename
* character set, plus the path separator (forward slash).
*/
-static int
+static size_t
parse_filename(char **line, char **filename)
{
char *b, *e;
@@ -317,10 +317,10 @@
size += (ve - vb) + 1;
if ((option = malloc(size)) == NULL)
return (NULL);
- strncpy(option, nb, ne - nb);
+ strncpy(option, nb, (size_t)(ne - nb));
if (ve > vb) {
option[ne - nb] = '=';
- strncpy(option + (ne - nb) + 1, vb, ve - vb);
+ strncpy(option + (ne - nb) + 1, vb, (size_t)(ve - vb));
}
option[size - 1] = '\0';
*line = q ? ve + 1 : ve;
@@ -364,7 +364,8 @@
pam_control_t ctlf;
char *line, *str, *name;
char *option, **optv;
- int len, lineno, ret;
+ size_t len;
+ int lineno, ret;
FILE *f;
if ((f = fopen(filename, "r")) == NULL) {
@@ -602,7 +603,7 @@
openpam_log(PAM_LOG_ERROR,
"No required or binding component "
"in service %s, facility %s",
- service, _pam_facility_name[PAM_AUTH]);
+ service, pam_facility_name[PAM_AUTH]);
goto load_err;
}
}
diff -r f568809b4191 -r 510efb798d51 external/bsd/openpam/dist/lib/openpam_dispatch.c
--- a/external/bsd/openpam/dist/lib/openpam_dispatch.c Sun Dec 25 23:18:25 2011 +0000
+++ b/external/bsd/openpam/dist/lib/openpam_dispatch.c Sun Dec 25 23:18:56 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: openpam_dispatch.c,v 1.2 2011/12/25 22:27:55 christos Exp $ */
+/* $NetBSD: openpam_dispatch.c,v 1.3 2011/12/25 23:18:56 christos Exp $ */
/*-
* Copyright (c) 2002-2003 Networks Associates Technology, Inc.
@@ -189,7 +189,7 @@
if (err == PAM_SUCCESS && nsuccess < 1) {
openpam_log(PAM_LOG_ERROR,
"all modules were unsuccessful for %s()",
- _pam_sm_func_name[primitive]);
+ pam_sm_func_name[primitive]);
err = PAM_SYSTEM_ERR;
}
#endif
diff -r f568809b4191 -r 510efb798d51 external/bsd/openpam/dist/lib/pam_set_item.c
--- a/external/bsd/openpam/dist/lib/pam_set_item.c Sun Dec 25 23:18:25 2011 +0000
+++ b/external/bsd/openpam/dist/lib/pam_set_item.c Sun Dec 25 23:18:56 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pam_set_item.c,v 1.2 2011/12/25 22:27:56 christos Exp $ */
+/* $NetBSD: pam_set_item.c,v 1.3 2011/12/25 23:18:56 christos Exp $ */
/*-
* Copyright (c) 2002-2003 Networks Associates Technology, Inc.
@@ -42,6 +42,7 @@
#endif
#include <sys/param.h>
+#include <sys/socket.h>
#include <stdlib.h>
#include <string.h>
@@ -75,7 +76,7 @@
/* set once only, by pam_start() */
if (*slot != NULL)
RETURNC(PAM_SYSTEM_ERR);
- /* fall through */
+ /*FALLTHROUGH*/
case PAM_USER:
case PAM_AUTHTOK:
case PAM_OLDAUTHTOK:
diff -r f568809b4191 -r 510efb798d51 external/bsd/openpam/openpam2netbsd
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/external/bsd/openpam/openpam2netbsd Sun Dec 25 23:18:56 2011 +0000
@@ -0,0 +1,107 @@
+#! /bin/sh
+#
+# $NetBSD: openpam2netbsd,v 1.1 2011/12/25 23:18:56 christos Exp $
+#
+# Copyright (c) 2011 The NetBSD Foundation, Inc.
+# 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, this list of conditions and the following disclaimer.
+# 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.
+#
+# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+# ``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 FOUNDATION OR CONTRIBUTORS
+# 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.
+#
+# openpam2netbsd: convert an openpam source tree into a
+# netbsd openp source tree, under src/dist,
+#
+# Rough instructions for importing new openp release:
+#
+# $ cd /some/where/temporary
+# $ tar xpfz /new/openpam/release/tar/file
+# $ sh /usr/src/external/bsd/openpam/openp2netbsd openpam-YYYYMMDD
+# $ cd openpam-YYYYMMDD
+# $ cvs -d cvs.netbsd.org:/cvsroot import -m "Import openpam-YYYYMMDD" src/external/bsd/openpam/dist OPENPAM flower-YYYYMMDD
+# $ cd ../../../am-utils-6.x.y
+# $ run ./configure
+# merge newly generated config.h with /usr/src/usr.sbin/openp/include/config.h
+# very carefully, since autoconfig seems to be broken (at least in 6.0.4)
+# $ cd ..
+# $ rm -r src am-utils-6.x.y
+# $ cd /usr/src/usr.sbin/openp
+# $ cvs commit -m "Updated autoconf generated files for am-utils 6.x.y."
+#
+# - check makefiles to see if any extra sources have been added.
+# - update distrib/sets if necessary.
+
+if [ $# -ne 1 ]; then echo "openp2netbsd src"; exit 1; fi
+
+r=$1
+case "$r" in
+ /*)
+ ;;
+ *)
+ r=`/bin/pwd`/$r
+ ;;
+esac
+
+cd $r
+
+### Remove the $'s around RCS tags
+cleantags $r
+
+### Add our NetBSD RCS Id
+find $r -type f -name '*.[chly]' -print | while read c; do
+ sed 1q < $c | grep -q '\$NetBSD' || (
+echo "/* \$NetBSD\$ */" >/tmp/openp3n$$
+echo "" >>/tmp/openp3n$$
+cat $c >> /tmp/openp3n$$
+mv /tmp/openp3n$$ $c && echo added NetBSD RCS tag to $c
+ )
+done
+
+find $r -type f -name '*.[0-9]' -print | while read m; do
+ sed 1q < $m | grep -q '\$NetBSD' || (
+echo ".\\\" \$NetBSD\$" >/tmp/openp2m$$
+echo ".\\\"" >>/tmp/openp2m$$
+cat $m >> /tmp/openp2m$$
+mv /tmp/openp2m$$ $m && echo added NetBSD RCS tag to $m
+ )
+done
+
+find $r -type f -name '*.texi' -print | while read t; do
+ sed "2 s/^/@c \$NetBSD\$\\
+/" < $t > /tmp/openp4t$$
+ mv /tmp/openp4t$$ $t && echo added NetBSD RCS tag to $t
+done
+
+echo done
+
+### Clean up any CVS directories that might be around.
+echo "cleaning up CVS residue."
+find $r -type d -name "CVS" -print | xargs rm -r
+echo done
+
+### Fixing file and directory permissions.
+echo "Fixing file/directory permissions."
+(
+ find $r -type f -print | xargs chmod u+rw,go+r
+ find $r -type d -print | xargs chmod u+rwx,go+rx
+)
+echo done
+
+exit 0
Home |
Main Index |
Thread Index |
Old Index