Skip to content

Commit

Permalink
Add friendlier method names.
Browse files Browse the repository at this point in the history
  • Loading branch information
Adam Palmblad committed Oct 6, 2015
1 parent 426bfcc commit cc33321
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 1 deletion.
3 changes: 3 additions & 0 deletions README
Expand Up @@ -31,15 +31,18 @@ _________________________________________________________
_________________________________________________________
getspent | * | * | * | *
getspnam(name) | * | * | * | *
from_user_name(name) (alias of above) | * | * | * | *
setspent | * | * | * | *
endspent | * | * | * | *
fgetspent(file) | * | * | N | N
sgetspent(str) | * | N | N | N
putspent(entry,file) | * | * | N | N
add_password_entry (alias of above ) | * | * | N | N
lckpwdf,lock | * | * | N | N
ulckpwdf,unlock | * | * | N | N
lock? | * | * | N | N

Check the implementation in use via Shadow::IMPLEMENTATION.

4. Structure

Expand Down
1 change: 1 addition & 0 deletions pwd/shadow.c
Expand Up @@ -126,4 +126,5 @@ Init_shadow()
rb_define_module_function(rb_mPasswd,"endspent",rb_shadow_endspent,0);
rb_define_module_function(rb_mPasswd,"getspent",rb_shadow_getspent,0);
rb_define_module_function(rb_mPasswd,"getspnam",rb_shadow_getspnam,1);
rb_define_module_function(rb_mPasswd,"from_user_name",rb_shadow_getspnam,1);
}
2 changes: 2 additions & 0 deletions shadow/shadow.c
Expand Up @@ -267,7 +267,9 @@ Init_shadow()
rb_define_module_function(rb_mPasswd,"fgetspent",rb_shadow_fgetspent,1);
rb_define_module_function(rb_mPasswd,"getspent",rb_shadow_getspent,0);
rb_define_module_function(rb_mPasswd,"getspnam",rb_shadow_getspnam,1);
rb_define_module_function(rb_mPasswd,"from_user_name",rb_shadow_getspnam,1);
rb_define_module_function(rb_mPasswd,"putspent",rb_shadow_putspent,2);
rb_define_module_function(rb_mPasswd,"add_password_entry",rb_shadow_putspent,2);
rb_define_module_function(rb_mPasswd,"lckpwdf",rb_shadow_lckpwdf,0);
rb_define_module_function(rb_mPasswd,"lock",rb_shadow_lock,0);
rb_define_module_function(rb_mPasswd,"ulckpwdf",rb_shadow_ulckpwdf,0);
Expand Down
13 changes: 12 additions & 1 deletion test/basic_test.rb
Expand Up @@ -21,13 +21,24 @@ def test_getspnam_for_non_existent_user
# -------------------------------------------------------------- test_putspent
def test_putspent
omit_if( Shadow::IMPLEMENTATION != 'SHADOW' )
Shadow::Passwd.putspent
result = StringIO.open( '', 'w' ) do |fh|
Shadow::Passwd.add_password_entry( sample_entry, fh )
end
raise result.inspect
end
# --------------------------------------------------------------- check_struct
def check_struct( s )
STRUCT_METHODS.each do |m|
s.send( m )
end
end
# ----------------------------------------------------------------- test_entry
def sample_entry( &block )
e = Shadow::Passwd::Entry.new
e.sp_namp = 'test_user'
e.sp_pwdp = 'password'
yield e if block_given?
return e
end
end

0 comments on commit cc33321

Please sign in to comment.