Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-15-SP4:Update
pam-config
pam-config-change-check-for-existence-of-module...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File pam-config-change-check-for-existence-of-modules.patch of Package pam-config
From 1d22b311136711e521e0e177d84cc3351d61e7e3 Mon Sep 17 00:00:00 2001 From: Thorsten Kukuk <kukuk@suse.com> Date: Sat, 2 May 2020 15:31:57 +0200 Subject: [PATCH] Change check for existence of modules If we have a biarch architecture, we check that the 64bit PAM module is there and report an error if not. For the 32bit variant, we only issue a warning. --- src/sanity_checks.c | 71 ++++++++++++++++++++++++++------------------- 1 file changed, 41 insertions(+), 30 deletions(-) diff --git a/src/sanity_checks.c b/src/sanity_checks.c index 7e31f16..7b92cca 100644 --- a/src/sanity_checks.c +++ b/src/sanity_checks.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2006, 2007, 2008, 2009, 2010, 2016 Thorsten Kukuk +/* Copyright (C) 2006, 2007, 2008, 2009, 2010, 2016, 2020 Thorsten Kukuk Author: Thorsten Kukuk <kukuk@thkukuk.de> This program is free software; you can redistribute it and/or modify @@ -27,41 +27,52 @@ #include "pam-config.h" #include "pam-module.h" -int -check_for_pam_module (const char *name, int force) +static int +check_for_pam_module_path (const char *path, const char *name, int force) { - const char *pamlib[] = { "/lib/libpam.so.0", "/lib64/libpam.so.0" }; - const char *path[] = { "/lib/security", "/lib64/security" }; - unsigned int i; - int retval = 0; + char module[strlen(path) + strlen (name) + 2]; - for (i = 0; i < (sizeof (path)/sizeof (char *)); i++) + sprintf (module, "%s/%s", path, name); + + if (access (module, F_OK) != 0) { - /* To check if we have a dual stack (32bit and 64bit), we do not need - only a /lib* /security directory, but /lib* /libpam.so.0 should be - installed, too. */ - if (access (pamlib[i], F_OK) == 0 && access (path[i], F_OK) == 0) + if (force) { - char module[strlen(path[i]) + strlen (name) + 2]; - - sprintf (module, "%s/%s", path[i], name); - - if (access (module, F_OK) != 0) - { - if (force) - fprintf (stderr, _("WARNING: module %s is not installed.\n"), - module); - else - { - fprintf (stderr, - _("ERROR: module %s is not installed.\n"), - module); - retval=1; - } - } + fprintf (stderr, _("WARNING: module %s is not installed.\n"), + module); + return 0; + } + else + { + fprintf (stderr, + _("ERROR: module %s is not installed.\n"), + module); + return 1; } } - return retval; + return 0; +} + +int +check_for_pam_module (const char *name, int force) +{ +#if defined(__LP64__) + int i = check_for_pam_module_path ("/lib64/security", name, force); + + if (i > 0) + return 1; + + /* Only print warning if 32bit PAM module is missing */ + if (access("/lib/libpam.so.0", F_OK) == 0) + return check_for_pam_module_path ("/lib/security", name, 1); +#else + int i = check_for_pam_module_path ("/lib/security", name, force); + + if (i > 0) + return 1; +#endif + + return 0; } static int -- 2.45.2
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor