| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | $NetBSD: patch-ab,v 1.1.1.1 2013/04/10 09:25:22 tonnerre Exp $ | | 1 | $NetBSD: patch-ab,v 1.2 2013/08/05 15:00:15 fhajny Exp $ |
2 | | | 2 | |
3 | Handle OSX-like password APIs. | | 3 | Handle OSX-like password APIs. |
4 | | | 4 | |
5 | --- shadow.c | | 5 | --- shadow.c |
6 | +++ shadow.c | | 6 | +++ shadow.c |
7 | @@ -7,8 +7,16 @@ | | 7 | @@ -7,8 +7,16 @@ |
8 | * License: Free for any use with your own risk! | | 8 | * License: Free for any use with your own risk! |
9 | * Modified at: <1999/8/19 06:48:18 by ttate> | | 9 | * Modified at: <1999/8/19 06:48:18 by ttate> |
10 | */ | | 10 | */ |
11 | - | | 11 | - |
12 | +#ifndef OSX | | 12 | +#ifndef OSX |
13 | #include <shadow.h> | | 13 | #include <shadow.h> |
14 | +#define PWTYPE struct spwd | | 14 | +#define PWTYPE struct spwd |
| @@ -55,29 +55,29 @@ Handle OSX-like password APIs. | | | @@ -55,29 +55,29 @@ Handle OSX-like password APIs. |
55 | + return rb_struct_new(rb_sPasswdEntry, | | 55 | + return rb_struct_new(rb_sPasswdEntry, |
56 | + rb_tainted_str_new2(entry->pw_name), | | 56 | + rb_tainted_str_new2(entry->pw_name), |
57 | + rb_tainted_str_new2(entry->pw_passwd ), | | 57 | + rb_tainted_str_new2(entry->pw_passwd ), |
58 | + difftime( entry->pw_change, 0 ) / 24*60*60, | | 58 | + difftime( entry->pw_change, 0 ) / 24*60*60, |
59 | + Qnil, /* days that password must stay same */ | | 59 | + Qnil, /* days that password must stay same */ |
60 | + Qnil, /* days until passwor changes. */ | | 60 | + Qnil, /* days until passwor changes. */ |
61 | + Qnil, /* days before expiration where user is warned */ | | 61 | + Qnil, /* days before expiration where user is warned */ |
62 | + Qnil, /* days after password expiration that account becomes inactive */ | | 62 | + Qnil, /* days after password expiration that account becomes inactive */ |
63 | + difftime( entry->pw_expire, 0 ) / 24*60*60, | | 63 | + difftime( entry->pw_expire, 0 ) / 24*60*60, |
64 | + Qnil, | | 64 | + Qnil, |
65 | + NULL); | | 65 | + NULL); |
66 | +} | | 66 | +} |
67 | +#else | | 67 | +#else |
68 | +static VALUE convert_pw_struct( spwd *entry ) | | 68 | +static VALUE convert_pw_struct( struct spwd *entry ) |
69 | +{ | | 69 | +{ |
70 | + result = rb_struct_new(rb_sPasswdEntry, | | 70 | + VALUE result = rb_struct_new(rb_sPasswdEntry, |
71 | + rb_tainted_str_new2(entry->sp_namp), | | 71 | + rb_tainted_str_new2(entry->sp_namp), |
72 | + rb_tainted_str_new2(entry->sp_pwdp), | | 72 | + rb_tainted_str_new2(entry->sp_pwdp), |
73 | + INT2FIX(entry->sp_lstchg), | | 73 | + INT2FIX(entry->sp_lstchg), |
74 | + INT2FIX(entry->sp_min), | | 74 | + INT2FIX(entry->sp_min), |
75 | + INT2FIX(entry->sp_max), | | 75 | + INT2FIX(entry->sp_max), |
76 | + INT2FIX(entry->sp_warn), | | 76 | + INT2FIX(entry->sp_warn), |
77 | + INT2FIX(entry->sp_inact), | | 77 | + INT2FIX(entry->sp_inact), |
78 | + INT2FIX(entry->sp_expire), | | 78 | + INT2FIX(entry->sp_expire), |
79 | + INT2FIX(entry->sp_flag), | | 79 | + INT2FIX(entry->sp_flag), |
80 | + NULL); | | 80 | + NULL); |
81 | +} | | 81 | +} |
82 | +#endif | | 82 | +#endif |
83 | #ifndef SOLARIS | | 83 | #ifndef SOLARIS |