ext/sys/admin.h in sys-admin-1.4.4 vs ext/sys/admin.h in sys-admin-1.4.5

- old
+ new

@@ -6,11 +6,11 @@ #include <grp.h> #include <fcntl.h> #include <errno.h> #include <string.h> -#define SYS_ADMIN_VERSION "1.4.4" +#define SYS_ADMIN_VERSION "1.4.5" #ifdef HAVE_LASTLOG_H #include <lastlog.h> #else #include <utmp.h> @@ -224,23 +224,24 @@ #ifdef HAVE_ST_PW_QUOTA rb_iv_set(v_user, "@quota", INT2FIX(pwd->pw_quota)); #endif #ifdef HAVE_ST_PW_CLASS - rb_iv_set(v_user, "@class", rb_str_new2(pwd->pw_class)); + rb_iv_set(v_user, "@access_class", rb_str_new2(pwd->pw_class)); #endif #ifdef HAVE_ST_PW_EXPIRE rb_iv_set(v_user, "@expire", rb_time_new(pwd->pw_expire, 0)); #endif #ifdef HAVE_ST_PW_CHANGE rb_iv_set(v_user, "@change", rb_time_new(pwd->pw_change, 0)); #endif - /* Get the lastlog info for the given user */ +#if defined(HAVE_LASTLOG_H) || defined(HAVE_UTMP_H) get_lastlog_info(pwd, v_user); +#endif return v_user; } /* @@ -311,11 +312,11 @@ if(!NIL_P(v_quota)) pwd->pw_quota = NUM2INT(v_quota); #endif #ifdef HAVE_ST_PW_CLASS - VALUE v_class = rb_iv_get(v_user, "@class"); + VALUE v_class = rb_iv_get(v_user, "@access_class"); if(!NIL_P(v_class)){ SafeStringValue(v_class); pwd->pw_class = StringValuePtr(v_class); } #endif @@ -406,9 +407,12 @@ /* * :no-doc: * * Helper function that gets lastlog information for the User object. + *-- + * Note that even if the platform supports lastlog information, it can + * still be empty or nil. */ int get_lastlog_info(struct passwd* pwd, VALUE v_user){ int fd; ssize_t bytes_read; struct lastlog log;