diff --git a/lib/Makefile.am b/lib/Makefile.am index 14c7b54eb..448ca22b7 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -27,8 +27,6 @@ libshadow_la_SOURCES = \ adds.c \ adds.h \ age.c \ - agetpass.c \ - agetpass.h \ alloc/calloc.c \ alloc/calloc.h \ alloc/malloc.c \ diff --git a/lib/agetpass.c b/lib/agetpass.c deleted file mode 100644 index d3b1407cd..000000000 --- a/lib/agetpass.c +++ /dev/null @@ -1,60 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2022, Alejandro Colomar - * - * SPDX-License-Identifier: BSD-3-Clause - */ - - -#include - -#include "agetpass.h" - -#include -#include -#include - -#ident "$Id$" - -#include "alloc/malloc.h" -#include "pass/passzero.h" -#include "pass/readpass.h" - - -static char * -agetpass_internal(const char *prompt, int flags) -{ - char *pass; - size_t len; - - pass = MALLOC(PASS_MAX + 2, char); - if (pass == NULL) - return NULL; - - if (readpass(pass, prompt, flags) == NULL) - goto fail; - - return pass; - -fail: - free(pass); - return NULL; -} - -// Similar to getpass(3), but free of its problems. -char * -agetpass(const char *prompt) -{ - return agetpass_internal(prompt, RPP_REQUIRE_TTY); -} - -char * -agetpass_stdin() -{ - return agetpass_internal(NULL, RPP_STDIN); -} - -void -erase_pass(char *pass) -{ - free(passzero(pass)); -} diff --git a/lib/agetpass.h b/lib/agetpass.h deleted file mode 100644 index 4a4444e1d..000000000 --- a/lib/agetpass.h +++ /dev/null @@ -1,23 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2022-2023, Alejandro Colomar - * SPDX-License-Identifier: BSD-3-Clause - */ - - -#ifndef SHADOW_INCLUDE_LIB_AGETPASS_H_ -#define SHADOW_INCLUDE_LIB_AGETPASS_H_ - - -#include - -#include "attr.h" -#include "defines.h" - - -void erase_pass(char *pass); -ATTR_MALLOC(erase_pass) -char *agetpass(const char *prompt); -char *agetpass_stdin(); - - -#endif // include guard