/etc functions for windows

djberg96 on 2003-08-06T04:58:58

I was going over some of the get* functions (getpwnam, getlogin, etc), and I noticed that they're still not implemented for Win32.

Then I happened across this page from MSDN and, in addition to some other interesting information for converting *nix to Win32 systems, it shows some ways to implement some of these functions use the Net* series of methods from the Windows library.

Would this be something worth adding for 5.10 or does the Win32API module already make this easy enough?


I don't see why not.

sky on 2003-08-06T13:35:57

If we can make them work on win32, it will make porting easier, but then I don't really know what I am talking about.

Re:I don't see why not.

djberg96 on 2003-08-06T15:15:21

The main issue would be that the API would be slightly different. In Unix-land, when you call getpwnam, you're checking against the local box. In Windows-land, you can check against the local box *or* a remote server that stores that info in a database.

That means getpwnam would have to allow a second argument (calling NetUserGetInfo() behind the scenes), but only on Win32. I dunno if Jarkko (or whoever the 5.10 pumpking is) would be ok with that or not.

Re:I don't see why not.

dlc on 2003-08-07T16:06:32

The main issue would be that the API would be slightly different. In Unix-land, when you call getpwnam, you're checking against the local box.

get* are also network aware, though -- they will query NIS and other authentication systems as necessary (as configured in /etc/nsswitch.conf or its moral equivalent).

Re:I don't see why not.

djberg96 on 2003-08-07T16:32:45

Ah, ok. There would still be a slight change in that you would need to accept an optional second argument. The 2nd argument (or NULL) would then be passed on as the server name to the NetUserGetInfo() call (or whatever). Presumably, it would just be ignored on *nix.

Also, the return values would be different. I was playing around last night and it appears that there are several options for the choice of struct you can grab, depending on your permissions level.

I guess as long as it's documented, it shouldn't be a big deal. Now, to actually get it to *work*. :)