From a3cd820d21ea9d6db2ddbd7ff95e96a88f810b8b Mon Sep 17 00:00:00 2001 From: "Todd C. Miller" Date: Wed, 15 Jan 2025 08:57:05 -0700 Subject: [PATCH] Move LOGIN_NAME_MAX compat define to login_max.c --- lib/util/login_max.c | 8 ++++++++ plugins/sudoers/cvtsudoers_pwutil.c | 8 -------- plugins/sudoers/pwutil_impl.c | 8 -------- 3 files changed, 8 insertions(+), 16 deletions(-) diff --git a/lib/util/login_max.c b/lib/util/login_max.c index 5f464d566..a3c6636e4 100644 --- a/lib/util/login_max.c +++ b/lib/util/login_max.c @@ -30,6 +30,14 @@ #include #include +#ifndef LOGIN_NAME_MAX +# ifdef _POSIX_LOGIN_NAME_MAX +# define LOGIN_NAME_MAX _POSIX_LOGIN_NAME_MAX +# else +# define LOGIN_NAME_MAX 9 +# endif +#endif /* LOGIN_NAME_MAX */ + size_t sudo_login_name_max_v1(void) { diff --git a/plugins/sudoers/cvtsudoers_pwutil.c b/plugins/sudoers/cvtsudoers_pwutil.c index c6b795042..481b7f69f 100644 --- a/plugins/sudoers/cvtsudoers_pwutil.c +++ b/plugins/sudoers/cvtsudoers_pwutil.c @@ -45,14 +45,6 @@ #include #include -#ifndef LOGIN_NAME_MAX -# ifdef _POSIX_LOGIN_NAME_MAX -# define LOGIN_NAME_MAX _POSIX_LOGIN_NAME_MAX -# else -# define LOGIN_NAME_MAX 9 -# endif -#endif /* LOGIN_NAME_MAX */ - #define FIELD_SIZE(src, name, size) \ do { \ if ((src)->name) { \ diff --git a/plugins/sudoers/pwutil_impl.c b/plugins/sudoers/pwutil_impl.c index 15fd1c354..fcfd3c166 100644 --- a/plugins/sudoers/pwutil_impl.c +++ b/plugins/sudoers/pwutil_impl.c @@ -41,14 +41,6 @@ #include #include -#ifndef LOGIN_NAME_MAX -# ifdef _POSIX_LOGIN_NAME_MAX -# define LOGIN_NAME_MAX _POSIX_LOGIN_NAME_MAX -# else -# define LOGIN_NAME_MAX 9 -# endif -#endif /* LOGIN_NAME_MAX */ - /* * For testsudoers and cvtsudoers need to support building with a different * function prefix and using custom getpwnam/getpwuid/getgrnam/getgrgid.