diff --git a/LoginCapture/linux/Makefile.am b/LoginCapture/linux/Makefile.am deleted file mode 100644 index e2a412f5..00000000 --- a/LoginCapture/linux/Makefile.am +++ /dev/null @@ -1,69 +0,0 @@ -####################################################################### -# -# Copyright (C) 2004 Novell, Inc. -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public -# License as published by the Free Software Foundation; either -# version 2 of the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public -# License along with this program; if not, write to the Free -# Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -# -# Author: Juan Carlos Luciani -# -####################################################################### - -SUBDIRS = install - -# handle Mono secondary dependencies -export MONO_PATH := $(MONO_PATH) - -PamMod_CFILES = $(srcdir)/pam_pwcapture.c -PamMod_OBJ = pam_pwcapture.o -PamMod_CSFILES_CSC := -PamMod_INCLUDES = -PamMod_RESOURCES = -PamMod_CFLAGS = $(CFLAGS) -PamMod_LIBS = -PamMod_LIBPATH = - -EXTRA_DIST = $(PamMod_CFILES) - -CUR_DIR := $(shell pwd) - -all: pam_pwcapture.so - -pam_pwcapture.so: $(PamMod_CFILES) - $(mkinstalldirs) bin/$(DEVENV_CONFIGURATION) - $(CC) -shared -lpam -lpam_misc -o bin/$(DEVENV_CONFIGURATION)/$@ $(PamMod_CFILES) - -install-exec-local: pam_pwcapture.so - $(mkinstalldirs) $(DESTDIR)$(libdir) - $(INSTALL_PROGRAM) bin/$(DEVENV_CONFIGURATION)/pam_pwcapture.so $(DESTDIR)$(libdir)/ - -uninstall-local: - cd $(DESTDIR)$(libdir); rm -f pam_pwcapture.so - rmdir $(DESTDIR)$(libdir) - -#installcheck-local: install -# $(mkinstalldirs) $(DESTDIR)$(libdir) -# $(INSTALL_PROGRAM) $(DESTDIR)$(libdir) -# cd $(DESTDIR)$(libdir); $(MONO) - -CLEAN_FILES = bin/$(DEVENV_CONFIGURATION)/pam_pwcapture.so - -clean-local: - rm -rf *.dbg *.exe *.so *.o *.dll $(CLEAN_FILES) $(COMMON_CLEAN_FILES) - -distclean-local: - -maintainer-clean-local: - rm -f Makefile.in - diff --git a/LoginCapture/linux/install/Makefile.am b/LoginCapture/linux/install/Makefile.am deleted file mode 100644 index 02ac2f3c..00000000 --- a/LoginCapture/linux/install/Makefile.am +++ /dev/null @@ -1,73 +0,0 @@ -####################################################################### -# -# Copyright (C) 2004 Novell, Inc. -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public -# License as published by the Free Software Foundation; either -# version 2 of the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public -# License along with this program; if not, write to the Free -# Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -# -# Author: Juan Carlos Luciani -# -####################################################################### - -if DEBUG -TARGET_CFG = Debug -else -TARGET_CFG = Release -endif - -# handle Mono secondary dependencies -export MONO_PATH := $(MONO_PATH) - -ModInstall_CFILES = $(srcdir)/modinstall.c -ModInstall_OBJ = modinstall.o -ModInstall_CSFILES_CSC := -ModInstall_INCLUDES = -ModInstall_RESOURCES = -ModInstall_CFLAGS = $(CFLAGS) -ModInstall_LIBS = -ModInstall_LIBPATH = - -EXTRA_DIST = $(ModInstall_CFILES) - -CUR_DIR := $(shell pwd) - -all: modinstall - -modinstall: $(ModInstall_CFILES) - $(mkinstalldirs) bin/$(TARGET_CFG) - $(CC) -g -o bin/$(TARGET_CFG)/$@ $(ModInstall_CFILES) - -install-exec-local: modinstall - $(mkinstalldirs) $(DESTDIR)$(bindir) - $(INSTALL_PROGRAM) bin/$(TARGET_CFG)/modinstall $(DESTDIR)$(bindir)/ - -uninstall-local: - cd $(DESTDIR)$(bindir); rm -f modinstall - rmdir $(DESTDIR)$(bindir) - -#installcheck-local: install -# $(mkinstalldirs) $(DESTDIR)$(bindir) -# $(INSTALL_PROGRAM) $(DESTDIR)$(bindir) -# cd $(DESTDIR)$(bindir); $(MONO) - -CLEAN_FILES = bin/$(TARGET_CFG)/modinstall - -clean-local: - rm -rf *.dbg *.exe *.so *.o *.dll $(CLEAN_FILES) $(COMMON_CLEAN_FILES) - -distclean-local: - -maintainer-clean-local: - rm -f Makefile.in - diff --git a/LoginCapture/linux/install/README b/LoginCapture/linux/install/README deleted file mode 100644 index 07aeac15..00000000 --- a/LoginCapture/linux/install/README +++ /dev/null @@ -1,75 +0,0 @@ -####################################################################### -# -# Copyright (C) 2004 Novell, Inc. -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public -# License as published by the Free Software Foundation; either -# version 2 of the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public -# License along with this program; if not, write to the Free -# Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -# -# Author: Juan Carlos Luciani -# -####################################################################### - -if DEBUG -TARGET_CFG = Debug -else -TARGET_CFG = Release -endif - -# handle Mono secondary dependencies -export MONO_PATH := $(MONO_PATH) - -PamMod_CFILES = $(srcdir)/pam_pwcapture.c -PamMod_OBJ = pam_pwcapture.o -PamMod_CSFILES_CSC := -PamMod_INCLUDES = -PamMod_RESOURCES = -PamMod_CFLAGS = $(CFLAGS) -PamMod_LIBS = -PamMod_LIBPATH = - -EXTRA_DIST = $(PamMod_CFILES) - -CUR_DIR := $(shell pwd) - -all: pam_pwcapture.so - -pam_pwcapture.so: $(PamMod_CFILES) - $(mkinstalldirs) ../Common/$(TARGET_CFG) - $(mkinstalldirs) bin/$(TARGET_CFG) - $(CC) -shared -lpam -lpam_misc -o bin/$(TARGET_CFG)/$@ $(PamMod_CFILES) - cp bin/$(TARGET_CFG)/$@ ../Common/$(TARGET_CFG)/$@ - -install-exec-local: pam_pwcapture.so - $(mkinstalldirs) $(DESTDIR)$(libdir) - $(INSTALL_PROGRAM) bin/$(TARGET_CFG)/pam_pwcapture.so $(DESTDIR)$(libdir)/ - -uninstall-local: - cd $(DESTDIR)$(libdir); rm -f pam_pwcapture.so - rmdir $(DESTDIR)$(libdir) - -#installcheck-local: install -# $(mkinstalldirs) $(DESTDIR)$(libdir) -# $(INSTALL_PROGRAM) $(DESTDIR)$(libdir) -# cd $(DESTDIR)$(libdir); $(MONO) - -CLEAN_FILES = bin/$(TARGET_CFG)/pam_pwcapture.so - -clean-local: - rm -rf *.dbg *.exe *.so *.o *.dll $(CLEAN_FILES) $(COMMON_CLEAN_FILES) - -distclean-local: - -maintainer-clean-local: - rm -f Makefile.in - diff --git a/LoginCapture/linux/install/modinstall.c b/LoginCapture/linux/install/modinstall.c deleted file mode 100644 index f4d76b62..00000000 --- a/LoginCapture/linux/install/modinstall.c +++ /dev/null @@ -1,304 +0,0 @@ -/*********************************************************************** - * File: modinstall.c - * Author: Juan Carlos Luciani (jluciani@novell.com) - * - * Abstract: Implements a utility to install or un-install the - * pam_pwcapture module. - * - * Copyright (C) 2004 Novell, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this library; if not, write to the Free - * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - ***********************************************************************/ - -#include "stdio.h" -#include "errno.h" -#include -#include - -typedef int BOOL; -#define TRUE 1 -#define FALSE 0 - - -// Usage string -char usage[] = "\nmodinstall: usage: [-i InstallPamConfigFilePath] [-u UninstallPamConfigFilePath]\n"; - -// Our PAM Configuration Line -char pamConfigLine[] = "auth required\tpam_pwcapture.so\n"; - - -/* ************************************************************************ - * InstallModule() - * - * Installs the pam_pwcapture file in the specified file. - * - * ************************************************************************/ -void -InstallModule(char *pFilePath) -{ - FILE *fp; - FILE *fpTemp; - fpos_t currLinePosition; - char currLine[512]; - BOOL authLineFound = FALSE; - BOOL insertedOurLine = FALSE; - - // Open temporary file - if ((fpTemp = tmpfile()) != NULL) - { - // Open the PAM config file for reading - if ((fp = fopen(pFilePath, "r")) != NULL) - { - // Copy the PAM config file onto the temp file - while (fgets(currLine, 512, fp) != NULL) - if (fputs(currLine, fpTemp) < 0) - fprintf(stderr, "Error writing line to temp file\n"); - - // Close the PAM Config file and reopen it for writing - fclose(fp); - if ((fp = fopen(pFilePath, "w")) != NULL) - { - // Reset the file position on the temp file to the beginning - if (fseek(fpTemp, 0, SEEK_SET) == 0) - { - // Now move the lines from the temp file onto the clean - // PAM config file looking for a place to insert our own - // line. - while (fgets(currLine, 512, fpTemp) != NULL) - { - // Check if we are dealing with a line configuring an authentication service - if (strlen(currLine) > 4 - && tolower(currLine[0]) == 'a' - && tolower(currLine[1]) == 'u' - && tolower(currLine[2]) == 't' - && tolower(currLine[3]) == 'h') - { - authLineFound = TRUE; - } - else - { - // This line is not configuring an authentication service, check if we - // now need to add a line for our module. - if (authLineFound && insertedOurLine == FALSE) - { - // Do not add our line if the line is commented out - if (strlen(currLine) > 1 - && currLine[0] != '#') - { - // Ok, now insert our line into the configuration. - if (fputs(pamConfigLine, fp) < 0) - fprintf(stderr, "Error writing line to PAM Config file\n"); - insertedOurLine = TRUE; - } - } - } - - if (fputs(currLine, fp) < 0) - fprintf(stderr, "Error writing line to PAM Config file\n"); - } - } - else - { - fprintf(stderr, "Error resetting position in temp file\n"); - } - - // Close the PAM Config file - fclose(fp); - } - else - { - fprintf(stderr, "Error reopening PAM Config file\n"); - } - } - else - { - fprintf(stderr, "Error opening PAM Config file for reading\n"); - } - - // Close the temporary file - fclose(fpTemp); - } - else - { - fprintf(stderr, "Unable to open temporary file\n"); - } -} - - -/* ************************************************************************ - * UninstallModule() - * - * Uninstalls the pam_pwcapture file from the specified file. - * - * ************************************************************************/ -void -UninstallModule(char *pFilePath) -{ - FILE *fp; - FILE *fpTemp; - char currLine[512]; - - // Open temporary file - if ((fpTemp = tmpfile()) != NULL) - { - // Open the PAM config file for reading - if ((fp = fopen(pFilePath, "r")) != NULL) - { - // Copy the PAM config file onto the temp file - while (fgets(currLine, 512, fp) != NULL) - if (fputs(currLine, fpTemp) < 0) - fprintf(stderr, "Error writing line to temp file\n"); - - // Close the PAM Config file and reopen it for writing - fclose(fp); - if ((fp = fopen(pFilePath, "w")) != NULL) - { - // Reset the file position on the temp file to the beginning - if (fseek(fpTemp, 0, SEEK_SET) == 0) - { - // Now move the lines from the temp file onto the clean - // PAM config file looking for our own line. - while (fgets(currLine, 512, fpTemp) != NULL) - { - // Write lines other than our own back to the PAM Config file - if (strcmp(currLine, pamConfigLine) != 0) - { - if (fputs(currLine, fp) < 0) - fprintf(stderr, "Error writing line to PAM Config file\n"); - } - } - } - else - { - fprintf(stderr, "Error resetting position in temp file\n"); - } - - // Close the PAM Config file - fclose(fp); - } - else - { - fprintf(stderr, "Error reopening PAM Config file\n"); - } - } - else - { - fprintf(stderr, "Error opening PAM Config file for reading\n"); - } - - // Close the temporary file - fclose(fpTemp); - } - else - { - fprintf(stderr, "Unable to open temporary file\n"); - } -} - - -/* ************************************************************************ - * main() - * - * Entry point for console application. - * - * ************************************************************************/ -int main(int argc, char* argv[]) -{ - int option; - int optionsSpecified = 0; - BOOL doneScanning = FALSE; - BOOL invalidUsage = FALSE; - char *pInstallFile = NULL; - char *pUninstallFile = NULL; - - // Scan options - while (!doneScanning) - { - opterr = 0; - option = getopt(argc, argv, "i:u:?"); - - // Proceed based on the result - switch (option) - { - case 'i': - // Install option, check the argument. - if (optarg != NULL) - { - // Record location of argument - pInstallFile = optarg; - optionsSpecified ++; - } - else - { - // No install file path specified - doneScanning = TRUE; - invalidUsage = TRUE; - } - break; - - case 'u': - // Uninstall option, check the argument. - if (optarg != NULL) - { - // Record location of argument - pUninstallFile = optarg; - optionsSpecified ++; - } - else - { - // No uninstall file path specified - doneScanning = TRUE; - invalidUsage = TRUE; - } - break; - - case '?': - // Invalid option detected - doneScanning = TRUE; - invalidUsage = TRUE; - break; - - default: - // Done scanning - doneScanning = TRUE; - break; - } - } - - // Do some sanity checking - if (!invalidUsage - && optionsSpecified) - { - // Check if we need to install the module - if (pInstallFile) - { - InstallModule(pInstallFile); - } - - // Check if we need to uninstall the module - if (pUninstallFile) - { - UninstallModule(pUninstallFile); - } - } - else - { - // Invalid option detected, print usage message. - printf(usage, argv[0]); - } - - return 0; -} - diff --git a/LoginCapture/linux/pam_pwcapture.c b/LoginCapture/linux/pam_pwcapture.c deleted file mode 100644 index fbe10327..00000000 --- a/LoginCapture/linux/pam_pwcapture.c +++ /dev/null @@ -1,239 +0,0 @@ -/*********************************************************************** - * File: pam_pwcapture.c - * Author: Juan Carlos Luciani (jluciani@novell.com) - * - * Abstract: Implements a PAM module that caches the username and - * password into the SecretStore wallet. - * - * Copyright (C) 2004 Novell, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this library; if not, write to the Free - * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - ***********************************************************************/ - -#define _GNU_SOURCE - -#include -#include -#ifndef LINUX -#include -#endif - -#define PAM_SM_AUTH -#define PAM_SM_ACCOUNT -#define PAM_SM_PASSWORD -#define PAM_SM_SESSION - -#include -#include - - -/* ************************************************************************ - * UpdateWallet() - * - * Updates the SecretStore wallet with the specified "Local" credentials. - * - * ************************************************************************/ -static void -LogError(char *pFormatStr, ... ) -{ - va_list args; - - openlog("pam_pwcapture", LOG_CONS | LOG_NOWAIT | LOG_ODELAY, LOG_USER); - va_start(args, pFormatStr); - vsyslog(LOG_USER | LOG_INFO, pFormatStr, args); - va_end(args); - closelog(); -} - - -/* ************************************************************************ - * UpdateWallet() - * - * Updates the SecretStore wallet with the specified "Local" credentials. - * - * ************************************************************************/ -void UpdateWallet(char *pUsername, - char *pPassword) -{ - // Do nothing at this time - // tbd -} - - -/* ************************************************************************ - * pam_sm_authenticate() - * - * Service provider implementation for pam_authenticate(). - * - * This is a PAM authentication management function. - * - * We are only interested in obtaining the username and password at this - * point and assume that the user has already been authenticated. - * - * ************************************************************************/ -PAM_EXTERN int -pam_sm_authenticate(pam_handle_t *pamh, - int flags, - int argc, - const char **argv) -{ - char *pUsername = NULL; - char *pPassword = NULL; - - // Obtain the username, note that we are not calling - // pam_get_user() because we assume that the user has - // already been prompted for his name based on where - // we are configured in the PAM chain. - if (pam_get_item(pamh, PAM_USER, (void*) &pUsername) == PAM_SUCCESS - && pUsername != NULL) - { - // We got the username, now get the password. - if (pam_get_item(pamh, PAM_AUTHTOK, (void*) &pPassword) == PAM_SUCCESS - && pPassword != NULL) - { - // We got the password, now set the information in the wallet. - UpdateWallet(pUsername, pPassword); - } - else - { - LogError("Unable to obtain password"); - } - } - else - { - LogError("Unable to obtain username"); - } - - // Always succeed, we do not want to risk messing up the user's login - return PAM_SUCCESS; -} - - -/* ************************************************************************ - * pam_sm_setcred() - * - * Service provider implementation for pam_setcred(). - * - * This is a PAM authentication management function. - * - * This function is here just for completedness and to protect against - * PAM misconfiguration. - * - * ************************************************************************/ -PAM_EXTERN int -pam_sm_setcred(pam_handle_t *pamh, - int flags, - int argc, - const char **argv) -{ - return PAM_SUCCESS; -} - - -/* ************************************************************************ - * pam_sm_acct_mgmt() - * - * Service provider implementation for pam_acct_mgmt(). - * - * This is a PAM account management function. - * - * This function is here just for completedness and to protect against - * PAM misconfiguration. - * - * ************************************************************************/ -PAM_EXTERN int -pam_sm_acct_mgmt(pam_handle_t *pamh, - int flags, - int argc, - const char **argv) -{ - return PAM_SUCCESS; -} - - -/* ************************************************************************ - * pam_sm_chauthtok() - * - * Service provider implementation for pam_chauthtok(). - * - * This is a PAM password management function. - * - * This function is here just for completedness and to protect against - * PAM misconfiguration. - * - * ************************************************************************/ -PAM_EXTERN int -pam_sm_chauthtok(pam_handle_t *pamh, - int flags, - int argc, - const char **argv) -{ - return PAM_SUCCESS; -} - - -/* ************************************************************************ - * pam_sm_open_session() - * - * Service provider implementation for pam_open_session(). - * - * This is a PAM session management function. - * - * This function is here just for completedness and to protect against - * PAM misconfiguration. - * - * ************************************************************************/ -PAM_EXTERN int pam_sm_open_session(pam_handle_t *pamh, - int flags, - int argc, - const char **argv) -{ - return PAM_SUCCESS; -} - - -/* ************************************************************************ - * pam_sm_close_session() - * - * Service provider implementation for pam_close_session(). - * - * This is a PAM session management function. - * - * This function is here just for completedness and to protect against - * PAM misconfiguration. - * - * ************************************************************************/ -PAM_EXTERN int pam_sm_close_session(pam_handle_t *pamh, - int flags, - int argc, - const char **argv) -{ - return PAM_SUCCESS; -} - - -/* static module data */ -#ifdef PAM_STATIC -struct pam_module _pam_pwcapture_modstruct = { - "pam_pwcapture", - pam_sm_authenticate, - pam_sm_setcred, - pam_sm_acct_mgmt, - pam_sm_chauthtok, - pam_sm_open_session, - pam_sm_close_session -}; -#endif -