]> git.armaanb.net Git - opendoas.git/commitdiff
libopenbsd: clean up readpassphrase compat and fix ifdefs
authorDuncan Overbruck <mail@duncano.de>
Thu, 12 Nov 2020 15:15:04 +0000 (16:15 +0100)
committerDuncan Overbruck <mail@duncano.de>
Thu, 12 Nov 2020 21:27:57 +0000 (22:27 +0100)
includes.h
libopenbsd/readpassphrase.c
libopenbsd/readpassphrase.h [deleted file]
libopenbsd/sys-readpassphrase.h [new file with mode: 0644]
pam.c
shadow.c

index 401a0e4f22d28fba3dd969bb38b69bb3ab8554cc..911d903c8c6d15459cf89e8ba2408656373fb8ad 100644 (file)
@@ -1,11 +1,6 @@
 #ifndef INCLUDES_H
 #define INCLUDES_H
 
-#ifndef _PATH_TTY
-# define _PATH_TTY "/dev/tty"
-#endif
-
-
 #include "openbsd.h"
 
 #ifdef USE_PAM
index a283969f38bcbdd1e6b43c37b51556bb714fa648..87675aa4374a29e5176b82469ba9096f7d0079ef 100644 (file)
 #include <signal.h>
 #include <ctype.h>
 #include <fcntl.h>
-#include <readpassphrase.h>
 #include <errno.h>
 #include <string.h>
 #include <unistd.h>
+#include <paths.h>
+
+#include "sys-readpassphrase.h"
+
+#ifndef _PATH_TTY
+#define _PATH_TTY "/dev/tty"
+#endif
 
 #ifndef TCSASOFT
 /* If we don't have TCSASOFT define it so that ORing it it below is a no-op. */
diff --git a/libopenbsd/readpassphrase.h b/libopenbsd/readpassphrase.h
deleted file mode 100644 (file)
index 5fd7c5d..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-/*     $OpenBSD: readpassphrase.h,v 1.5 2003/06/17 21:56:23 millert Exp $      */
-
-/*
- * Copyright (c) 2000, 2002 Todd C. Miller <Todd.Miller@courtesan.com>
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * Sponsored in part by the Defense Advanced Research Projects
- * Agency (DARPA) and Air Force Research Laboratory, Air Force
- * Materiel Command, USAF, under agreement number F39502-99-1-0512.
- */
-
-/* OPENBSD ORIGINAL: include/readpassphrase.h */
-
-#ifndef _READPASSPHRASE_H_
-#define _READPASSPHRASE_H_
-
-#include "includes.h"
-
-#ifndef HAVE_READPASSPHRASE
-
-#define RPP_ECHO_OFF    0x00           /* Turn off echo (default). */
-#define RPP_ECHO_ON     0x01           /* Leave echo on. */
-#define RPP_REQUIRE_TTY 0x02           /* Fail if there is no tty. */
-#define RPP_FORCELOWER  0x04           /* Force input to lower case. */
-#define RPP_FORCEUPPER  0x08           /* Force input to upper case. */
-#define RPP_SEVENBIT    0x10           /* Strip the high bit from input. */
-#define RPP_STDIN       0x20           /* Read from stdin, not /dev/tty */
-
-char * readpassphrase(const char *, char *, size_t, int);
-
-#endif /* HAVE_READPASSPHRASE */
-
-#endif /* !_READPASSPHRASE_H_ */
diff --git a/libopenbsd/sys-readpassphrase.h b/libopenbsd/sys-readpassphrase.h
new file mode 100644 (file)
index 0000000..5fd7c5d
--- /dev/null
@@ -0,0 +1,44 @@
+/*     $OpenBSD: readpassphrase.h,v 1.5 2003/06/17 21:56:23 millert Exp $      */
+
+/*
+ * Copyright (c) 2000, 2002 Todd C. Miller <Todd.Miller@courtesan.com>
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Sponsored in part by the Defense Advanced Research Projects
+ * Agency (DARPA) and Air Force Research Laboratory, Air Force
+ * Materiel Command, USAF, under agreement number F39502-99-1-0512.
+ */
+
+/* OPENBSD ORIGINAL: include/readpassphrase.h */
+
+#ifndef _READPASSPHRASE_H_
+#define _READPASSPHRASE_H_
+
+#include "includes.h"
+
+#ifndef HAVE_READPASSPHRASE
+
+#define RPP_ECHO_OFF    0x00           /* Turn off echo (default). */
+#define RPP_ECHO_ON     0x01           /* Leave echo on. */
+#define RPP_REQUIRE_TTY 0x02           /* Fail if there is no tty. */
+#define RPP_FORCELOWER  0x04           /* Force input to lower case. */
+#define RPP_FORCEUPPER  0x08           /* Force input to upper case. */
+#define RPP_SEVENBIT    0x10           /* Strip the high bit from input. */
+#define RPP_STDIN       0x20           /* Read from stdin, not /dev/tty */
+
+char * readpassphrase(const char *, char *, size_t, int);
+
+#endif /* HAVE_READPASSPHRASE */
+
+#endif /* !_READPASSPHRASE_H_ */
diff --git a/pam.c b/pam.c
index ee02b0faab8fa43d7c48e28d2f9cf569e9d2b82f..b921069b195a8a4d89b714f07d264bcc50cfb4d5 100644 (file)
--- a/pam.c
+++ b/pam.c
 #include <errno.h>
 #include <limits.h>
 #include <pwd.h>
-#ifdef HAVE_READPASSPHRASE_H
+#ifdef HAVE_READPASSPHRASE
 #      include <readpassphrase.h>
 #else
-#      include "readpassphrase.h"
+#      include "sys-readpassphrase.h"
 #endif
 #include <signal.h>
 #include <stdio.h>
index de53cea411d26598844f0fd40a4bb99f4830997a..8489017b167516835bf03d7102bbb4dcdee63996 100644 (file)
--- a/shadow.c
+++ b/shadow.c
 #include <errno.h>
 #include <limits.h>
 #include <pwd.h>
-#ifdef HAVE_READPASSPHRASE_H
+#ifdef HAVE_READPASSPHRASE
 #      include <readpassphrase.h>
 #else
-#      include "readpassphrase.h"
+#      include "sys-readpassphrase.h"
 #endif
 #include <shadow.h>
 #include <stdio.h>