summaryrefslogtreecommitdiff
path: root/source4/lib
diff options
context:
space:
mode:
Diffstat (limited to 'source4/lib')
-rw-r--r--source4/lib/basic.mk3
-rw-r--r--source4/lib/pam_errors.c126
-rw-r--r--source4/lib/util_file.c90
3 files changed, 1 insertions, 218 deletions
diff --git a/source4/lib/basic.mk b/source4/lib/basic.mk
index 7b95632c70..86392cfc40 100644
--- a/source4/lib/basic.mk
+++ b/source4/lib/basic.mk
@@ -35,9 +35,6 @@ INIT_OBJ_FILES = \
# End SUBSYSTEM LIBCOMPRESION
################################################
-[SUBSYSTEM::PAM_ERRORS]
-OBJ_FILES = lib/pam_errors.o
-
[SUBSYSTEM::GENCACHE]
OBJ_FILES = \
lib/gencache.o \
diff --git a/source4/lib/pam_errors.c b/source4/lib/pam_errors.c
deleted file mode 100644
index a00464e624..0000000000
--- a/source4/lib/pam_errors.c
+++ /dev/null
@@ -1,126 +0,0 @@
-/*
- * Unix SMB/CIFS implementation.
- * PAM error mapping functions
- * Copyright (C) Andrew Bartlett 2002
- *
- * 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.
- */
-
-#include "includes.h"
-
-#ifdef WITH_HAVE_SECURITY_PAM_APPL_H
-#include <security/pam_appl.h>
-
-#if defined(PAM_AUTHTOK_RECOVERY_ERR) && !defined(PAM_AUTHTOK_RECOVER_ERR)
-#define PAM_AUTHTOK_RECOVER_ERR PAM_AUTHTOK_RECOVERY_ERR
-#endif
-
-/* PAM -> NT_STATUS map */
-static const struct {
- int pam_code;
- NTSTATUS ntstatus;
-} pam_to_nt_status_map[] = {
- {PAM_OPEN_ERR, NT_STATUS_UNSUCCESSFUL},
- {PAM_SYMBOL_ERR, NT_STATUS_UNSUCCESSFUL},
- {PAM_SERVICE_ERR, NT_STATUS_UNSUCCESSFUL},
- {PAM_SYSTEM_ERR, NT_STATUS_UNSUCCESSFUL},
- {PAM_BUF_ERR, NT_STATUS_UNSUCCESSFUL},
- {PAM_PERM_DENIED, NT_STATUS_ACCESS_DENIED},
- {PAM_AUTH_ERR, NT_STATUS_WRONG_PASSWORD},
- {PAM_CRED_INSUFFICIENT, NT_STATUS_INSUFFICIENT_LOGON_INFO}, /* FIXME: Is this correct? */
- {PAM_AUTHINFO_UNAVAIL, NT_STATUS_LOGON_FAILURE},
- {PAM_USER_UNKNOWN, NT_STATUS_NO_SUCH_USER},
- {PAM_MAXTRIES, NT_STATUS_REMOTE_SESSION_LIMIT}, /* FIXME: Is this correct? */
- {PAM_NEW_AUTHTOK_REQD, NT_STATUS_PASSWORD_MUST_CHANGE},
- {PAM_ACCT_EXPIRED, NT_STATUS_ACCOUNT_EXPIRED},
- {PAM_SESSION_ERR, NT_STATUS_INSUFFICIENT_RESOURCES},
- {PAM_CRED_UNAVAIL, NT_STATUS_NO_TOKEN}, /* FIXME: Is this correct? */
- {PAM_CRED_EXPIRED, NT_STATUS_PASSWORD_EXPIRED}, /* FIXME: Is this correct? */
- {PAM_CRED_ERR, NT_STATUS_UNSUCCESSFUL},
- {PAM_AUTHTOK_ERR, NT_STATUS_UNSUCCESSFUL},
-#ifdef PAM_AUTHTOK_RECOVER_ERR
- {PAM_AUTHTOK_RECOVER_ERR, NT_STATUS_UNSUCCESSFUL},
-#endif
- {PAM_AUTHTOK_EXPIRED, NT_STATUS_PASSWORD_EXPIRED},
- {PAM_SUCCESS, NT_STATUS_OK}
-};
-
-/* NT_STATUS -> PAM map */
-static const struct {
- NTSTATUS ntstatus;
- int pam_code;
-} nt_status_to_pam_map[] = {
- {NT_STATUS_UNSUCCESSFUL, PAM_SYSTEM_ERR},
- {NT_STATUS_NO_SUCH_USER, PAM_USER_UNKNOWN},
- {NT_STATUS_WRONG_PASSWORD, PAM_AUTH_ERR},
- {NT_STATUS_LOGON_FAILURE, PAM_AUTH_ERR},
- {NT_STATUS_ACCOUNT_EXPIRED, PAM_ACCT_EXPIRED},
- {NT_STATUS_PASSWORD_EXPIRED, PAM_AUTHTOK_EXPIRED},
- {NT_STATUS_PASSWORD_MUST_CHANGE, PAM_NEW_AUTHTOK_REQD},
- {NT_STATUS_OK, PAM_SUCCESS}
-};
-
-/*****************************************************************************
-convert a PAM error to a NT status32 code
- *****************************************************************************/
-NTSTATUS pam_to_nt_status(int pam_error)
-{
- int i;
- if (pam_error == 0) return NT_STATUS_OK;
-
- for (i=0; NT_STATUS_V(pam_to_nt_status_map[i].ntstatus); i++) {
- if (pam_error == pam_to_nt_status_map[i].pam_code)
- return pam_to_nt_status_map[i].ntstatus;
- }
- return NT_STATUS_UNSUCCESSFUL;
-}
-
-/*****************************************************************************
-convert an NT status32 code to a PAM error
- *****************************************************************************/
-int nt_status_to_pam(NTSTATUS nt_status)
-{
- int i;
- if NT_STATUS_IS_OK(nt_status) return PAM_SUCCESS;
-
- for (i=0; NT_STATUS_V(nt_status_to_pam_map[i].ntstatus); i++) {
- if (NT_STATUS_EQUAL(nt_status,nt_status_to_pam_map[i].ntstatus))
- return nt_status_to_pam_map[i].pam_code;
- }
- return PAM_SYSTEM_ERR;
-}
-
-#else
-
-/*****************************************************************************
-convert a PAM error to a NT status32 code
- *****************************************************************************/
-NTSTATUS pam_to_nt_status(int pam_error)
-{
- if (pam_error == 0) return NT_STATUS_OK;
- return NT_STATUS_UNSUCCESSFUL;
-}
-
-/*****************************************************************************
-convert an NT status32 code to a PAM error
- *****************************************************************************/
-int nt_status_to_pam(NTSTATUS nt_status)
-{
- if (NT_STATUS_EQUAL(nt_status, NT_STATUS_OK)) return 0;
- return 4; /* PAM_SYSTEM_ERR */
-}
-
-#endif
-
diff --git a/source4/lib/util_file.c b/source4/lib/util_file.c
index 338b9547a5..156d09aaf5 100644
--- a/source4/lib/util_file.c
+++ b/source4/lib/util_file.c
@@ -22,94 +22,6 @@
#include "system/shmem.h"
#include "system/filesys.h"
-/*************************************************************************
- gets a line out of a file.
- line is of format "xxxx:xxxxxx:xxxxx:".
- lines with "#" at the front are ignored.
-*************************************************************************/
-int getfileline(void *vp, char *linebuf, int linebuf_size)
-{
- /* Static buffers we will return. */
- FILE *fp = (FILE *)vp;
- uint8_t c;
- uint8_t *p;
- size_t linebuf_len;
-
- if (fp == NULL)
- {
- DEBUG(0,("getfileline: Bad file pointer.\n"));
- return -1;
- }
-
- /*
- * Scan the file, a line at a time.
- */
- while (!feof(fp))
- {
- linebuf[0] = '\0';
-
- fgets(linebuf, linebuf_size, fp);
- if (ferror(fp))
- {
- return -1;
- }
-
- /*
- * Check if the string is terminated with a newline - if not
- * then we must keep reading and discard until we get one.
- */
-
- linebuf_len = strlen(linebuf);
- if (linebuf_len == 0)
- {
- linebuf[0] = '\0';
- return 0;
- }
-
- if (linebuf[linebuf_len - 1] != '\n')
- {
- c = '\0';
- while (!ferror(fp) && !feof(fp))
- {
- c = fgetc(fp);
- if (c == '\n')
- {
- break;
- }
- }
- }
- else
- {
- linebuf[linebuf_len - 1] = '\0';
- }
-
-#ifdef DEBUG_PASSWORD
- DEBUG(100, ("getfileline: got line |%s|\n", linebuf));
-#endif
- if ((linebuf[0] == 0) && feof(fp))
- {
- DEBUG(4, ("getfileline: end of file reached\n"));
- return 0;
- }
-
- if (linebuf[0] == '#' || linebuf[0] == '\0')
- {
- DEBUG(6, ("getfileline: skipping comment or blank line\n"));
- continue;
- }
-
- p = (uint8_t *) strchr_m(linebuf, ':');
- if (p == NULL)
- {
- DEBUG(0, ("getfileline: malformed line entry (no :)\n"));
- continue;
- }
- return linebuf_len;
- }
- return -1;
-}
-
-
/****************************************************************************
read a line from a file with possible \ continuation chars.
Blanks at the start or end of a line are stripped.
@@ -350,7 +262,7 @@ char **fd_lines_load(int fd, int *numlines, TALLOC_CTX *mem_ctx)
/****************************************************************************
-take a lislist of lines and modify them to produce a list where \ continues
+take a list of lines and modify them to produce a list where \ continues
a line
****************************************************************************/
void file_lines_slashcont(char **lines)