win32utils-devel@rubyforge.org
2004-Mar-01 12:21 UTC
[Win32utils-devel] RE: win32etc test failure
For delete_user, try this patch: etc.c, line 639: - lpHost = (LPCWSTR)STR2CSTR(rbHost); +lpHost = AllocWideLString(rbHost); Lemme know how it goes. Dan -----Original Message----- From: win32utils-devel-bounces@rubyforge.org [mailto:win32utils-devel-bounces@rubyforge.org] On Behalf Of win32utils-devel@rubyforge.org Sent: Monday, March 01, 2004 10:02 AM To: Date, Shashank [Non-Employee] Cc: win32utils-devel@rubyforge.org Subject: [Win32utils-devel] RE: win32etc test failure Ok - time for me to patch and update the docs! Thanks for the testing! Dan -----Original Message----- From: Date, Shashank [Non-Employee] [mailto:Shashank.Date@mail.sprint.com] Sent: Monday, March 01, 2004 10:02 AM To: Berger, Daniel Subject: RE: win32etc test failure I like your approach better: allow me to be lazy (so I am not _forced_ to give it) but forgive me if I do ;-) It worked for add_user both with AND without \\ -- Shashank -----Original Message----- From: Berger, Daniel [mailto:djberge@qwest.com] Sent: Monday, March 01, 2004 10:53 AM To: Date, Shashank [Non-Employee] Cc: win32utils-devel@rubyforge.org Subject: RE: win32etc test failure Yep, I agree. Well, what would you prefer? I handle it for you or you handle it yourself? I''m tempted to go with the former because, well, it''s been there for a while now. I can even use strtok to detect if ''\\\\'' is at the beginning of the string and add them only if not found. I''ll have to take a look at delete user - it worked for add_user, right? Hmm... Dan -----Original Message----- From: Date, Shashank [Non-Employee] [mailto:Shashank.Date@mail.sprint.com] Sent: Monday, March 01, 2004 9:49 AM To: Berger, Daniel Subject: RE: win32etc test failure My preference: POLS ! Either do it for _all_ the situations, no exceptions OR do not do it at all. delete_user did not work with OR without the \\. getpwnam worked without the \\. Thanks, -- Shashank -----Original Message----- From: Berger, Daniel [mailto:djberge@qwest.com] Sent: Monday, March 01, 2004 10:40 AM To: Date, Shashank [Non-Employee] Subject: RE: win32etc test failure Oops - I think I tried to be helpful by automatically prepending ''\\\\'' in some cases (see line 321 in etc.c for example). Try just a plain host name. I should document that better or just not do it at all - thoughts? Dan -----Original Message----- From: Date, Shashank [Non-Employee] [mailto:Shashank.Date@mail.sprint.com] Sent: Monday, March 01, 2004 9:27 AM To: Berger, Daniel Subject: RE: win32etc test failure That worked ... great ! In general, though, some functions (like getpwnam, delete_user) do not work when the remote host parameter is given, even though it is the * local machine *. Code attached. -- Shashank -----Original Message----- From: Berger, Daniel [mailto:djberge@qwest.com] Sent: Monday, March 01, 2004 10:06 AM To: Date, Shashank [Non-Employee] Subject: RE: win32etc test failure Well, if you want to change the password for a user on a remote host, you have to include it as the 4th argument to change_password. Otherwise, it assumes the local host. What is the code you''re using? Dan -----Original Message----- From: Date, Shashank [Non-Employee] [mailto:Shashank.Date@mail.sprint.com] Sent: Monday, March 01, 2004 8:44 AM To: Berger, Daniel Subject: RE: win32etc test failure But of course ! Duh !! Ok, so now it is doing this: C:/atest/tst_win32_etc.rb:14:in `change_password'': No such file or directory - user not found (Errno::ENOENT) from C:/atest/tst_win32_etc.rb:14 Thanks for being patient with me. -- Shashank -----Original Message----- From: Berger, Daniel [mailto:djberge@qwest.com] Sent: Monday, March 01, 2004 9:39 AM To: Date, Shashank [Non-Employee] Subject: RE: win32etc test failure I wonder if you need to do "\\\\dbm-team-date." - I didn''t have a way to test adding to a remote host on my machine at home. :) Does it work if you add the user locally? Dan -----Original Message----- From: Date, Shashank [Non-Employee] [mailto:Shashank.Date@mail.sprint.com] Sent: Monday, March 01, 2004 8:29 AM To: Berger, Daniel Subject: RE: win32etc test failure Ok, no problem. Here is some more ...(like you have nothing else to do ;-)) -- Shashank ------------------------------------------------------------------------ -- Microsoft Windows 2000 [Version 5.00.2195] (C) Copyright 1985-2000 Microsoft Corp. C:\atest>type tst_win32_etc.rb require "win32/etc" include Win32 include Etc Etc::Admin.add_user( :user_name => "some_user", :password => "abc123def", :home_dir => "C:\\foo_user", :description => "random text", :host => "\\dbm-team-date", :flags => Admin::ACCOUNTDISABLE ) Etc::Admin.change_password("abc123def","hello","some_user") Etc::Admin.delete_user(user,host) Etc::Admin.add_group( :group_name => "foo", :description => "Test Group", :local? => true, :users => %w/matz guido larry/ ) C:\atest>ruby tst_win32_etc.rb tst_win32_etc.rb:11:in `add_user'': No such file or directory - unknown error: 123 (Errno::ENOENT) from tst_win32_etc.rb:11 C:\atest>dir c:\foo_user Volume in drive C is LOCAL Volume Serial Number is AC53-D8CC Directory of c:\foo_user 03/01/2004 09:21a <DIR> . 03/01/2004 09:21a <DIR> .. 0 File(s) 0 bytes 2 Dir(s) 39,319,654,400 bytes free C:\atest> -----Original Message----- From: Berger, Daniel [mailto:djberge@qwest.com] Sent: Monday, March 01, 2004 9:26 AM To: Date, Shashank [Non-Employee] Subject: RE: win32etc test failure Hi Shashank, Well, that test requires that another test occur first - I wonder if it''s just "out of order". I''ll double check. Dan -----Original Message----- From: Date, Shashank [Non-Employee] [mailto:Shashank.Date@mail.sprint.com] Sent: Monday, March 01, 2004 8:18 AM To: Berger, Daniel Subject: win32etc test failure C:\extract\win32-etc-0.2.0>ruby test.rb Loaded suite test Started ..F.......... Finished in 2.944 seconds. 1) Failure!!! test_02_change_password(TC_Win32Etc) [test.rb:116]: Exception raised: Class: <Errno::ENOENT> Message: <No such file or directory - user not found> ---Backtrace--- test.rb:115:in `change_password'' test.rb:115:in `test_02_change_password'' test.rb:114:in `assert_nothing_raised'' c:/ruby/lib/ruby/1.8/test/unit/assertions.rb:172:in `_wrap_assertion'' c:/ruby/lib/ruby/1.8/test/unit/assertions.rb:191:in `assert_nothing_raised'' test.rb:116:in `test_02_change_password'' c:/ruby/lib/ruby/1.8/test/unit/testcase.rb:68:in `send'' c:/ruby/lib/ruby/1.8/test/unit/testcase.rb:68:in `run'' c:/ruby/lib/ruby/1.8/test/unit/testsuite.rb:34:in `run'' c:/ruby/lib/ruby/1.8/test/unit/testsuite.rb:33:in `each'' c:/ruby/lib/ruby/1.8/test/unit/testsuite.rb:33:in `run'' c:/ruby/lib/ruby/1.8/test/unit/testsuite.rb:34:in `run'' c:/ruby/lib/ruby/1.8/test/unit/testsuite.rb:33:in `each'' c:/ruby/lib/ruby/1.8/test/unit/testsuite.rb:33:in `run'' c:/ruby/lib/ruby/1.8/test/unit/ui/testrunnermediator.rb:53:in `run_suite'' c:/ruby/lib/ruby/1.8/test/unit/ui/console/testrunner.rb:77:in `start_mediator'' c:/ruby/lib/ruby/1.8/test/unit/ui/console/testrunner.rb:51:in `start'' c:/ruby/lib/ruby/1.8/test/unit/ui/console/testrunner.rb:26:in `run'' c:/ruby/lib/ruby/1.8/test/unit.rb:178 c:/ruby/lib/ruby/1.8/test/unit.rb:176:in `call'' c:/ruby/lib/ruby/1.8/test/unit.rb:213 c:/ruby/lib/ruby/1.8/test/unit.rb:162 test.rb:123 --------------- 13 tests, 27 assertions, 1 failures, 0 errors C:\extract\win32-etc-0.2.0> -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/win32utils-devel/attachments/20040301/34ec0145/attachment-0001.htm