From a0c0d58dca13338e24fe0a2e926f1b3e93aee722 Mon Sep 17 00:00:00 2001 From: Ed Schouten Date: Thu, 13 Oct 2011 14:44:38 +0200 Subject: [PATCH 2/4] Make use of optional. The header is a Linux-specific extension. On FreeBSD, all functionality is integrated into the interface. Signed-off-by: Ed Schouten --- configure.ac | 2 +- src/user.c | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletions(-) diff --git a/configure.ac b/configure.ac index 216d8e6..352adde 100644 --- a/configure.ac +++ b/configure.ac @@ -120,7 +120,7 @@ AC_CACHE_CHECK([for supported warning flags], accountsservice_cv_warn_cflags, [ WARN_CFLAGS="$accountsservice_cv_warn_cflags" AC_SUBST(WARN_CFLAGS) -AC_CHECK_HEADERS([utmpx.h]) +AC_CHECK_HEADERS([shadow.h utmpx.h]) dnl --------------------------------------------------------------------------- dnl - DocBook Documentation diff --git a/src/user.c b/src/user.c index 8f0bdd3..9c892b8 100644 --- a/src/user.c +++ b/src/user.c @@ -29,7 +29,9 @@ #include #include #include +#ifdef HAVE_SHADOW_H #include +#endif #include #include @@ -464,7 +466,9 @@ void user_local_update_from_pwent (User *user, struct passwd *pwent) { +#ifdef HAVE_SHADOW_H struct spwd *spent; +#endif gchar *real_name; gboolean changed; const gchar *passwd; @@ -555,9 +559,11 @@ user_local_update_from_pwent (User *user, } passwd = pwent->pw_passwd; +#ifdef HAVE_SHADOW_H spent = getspnam (pwent->pw_name); if (spent) passwd = spent->sp_pwdp; +#endif if (passwd && passwd[0] == '!') { locked = TRUE; @@ -579,11 +585,13 @@ user_local_update_from_pwent (User *user, mode = PASSWORD_MODE_REGULAR; } +#ifdef HAVE_SHADOW_H if (spent) { if (spent->sp_lstchg == 0) { mode = PASSWORD_MODE_SET_AT_LOGIN; } } +#endif if (user->password_mode != mode) { user->password_mode = mode; -- 1.7.7