commit 20f7a94e1890facb6e7f1a12acf4cf5e1e8de977 from: Omar Polo date: Fri Oct 07 07:57:31 2022 UTC work around missing LOGIN_NAME_MAX Both Linux and OpenBSD have LOGIN_NAME_MAX available when including limits.h, FreeBSD, Darwin and possibly others don't. FreeBSD (and maybe Darwin) have MAXLOGNAME, so try to use that if available. Otherwise use _POSIX_LOGIN_NAME_MAX, but only has a fallback since it has a lower value (9 at the time of writing). If everything fails, use 32 which is what OpenBSD use by default; OpenSMTPd also defaults to it. See also github issue #1 commit - a02f394431fcc473fb8290b17036d1275d2ccf0a commit + 20f7a94e1890facb6e7f1a12acf4cf5e1e8de977 blob - f076107c77bf22a64cbe48841f2a93e082efa10a blob + d6f802df3d1937acb06856cd8af71350a4b41fda --- kamid/kamid.h +++ kamid/kamid.h @@ -21,6 +21,17 @@ #include #include +/* Linux and OpenBSD have LOGIN_NAME_MAX, FreeBSD MAXLOGNAME. */ +#ifndef LOGIN_NAME_MAX +# if defined(MAXLOGNAME) +# define LOGIN_NAME_MAX MAXLOGNAME +# elif defined(_POSIX_LOGIN_NAME_MAX) +# define LOGIN_NAME_MAX _POSIX_LOGIN_NAME_MAX +# else +# define LOGIN_NAME_MAX 32 +# endif +#endif + /* TODO: make these customizable */ #define KD_CONF_FILE "/etc/kamid.conf" #define KD_USER "_kamid"