[Mono-list] Mono.Posix.Syscall.passwd patch

Loren Bandiera lorenb@mmgsecurity.com
Tue, 14 Sep 2004 18:40:43 -0400


--=-esCU2lAc8s30Bxt7iYoG
Content-Type: text/plain
Content-Transfer-Encoding: 7bit


Here is my patch for adding a wrapper for getpwnam(3) to
Mono.Posix.Syscall.  I tried to model it after stat().

You can use this to get the password file entry for a given username.
The fields are:

	Account
	Password
	Uid
	Gid
	Gecos
	HomeDirectory
	Shell

Some sample code:

using System;
using Mono.Posix;

Passwd passwd;
string username = "root";
int result = 0;

result = Syscall.passwd (username, out passwd);
Console.WriteLine ("username: {0} shell: {1}", username, passwd.Shell)


Thanks to Jackson Harper for helping me with my testing issues.  

-- 
Loren Bandiera, CISSP <lorenb@mmgsecurity.com>
MMG Security, Inc.

--=-esCU2lAc8s30Bxt7iYoG
Content-Disposition: attachment; filename=mono-posix-getpwnam.tgz
Content-Type: application/x-compressed-tar; name=mono-posix-getpwnam.tgz
Content-Transfer-Encoding: base64

H4sICJttR0EAA2ZyLjIwNzc0LjAubW9uby1wb3NpeC1nZXRwd25hbS50YXIA7VbbbttGENXr8ium
fpJMUeZNVCxDgYOmcFzEhRDBT0VhMNRaJkqRBC+xhcD/3tkLl6QjKQ91b+geQOLu7HA4M7uzZ7ZZ
mll5VsZP1oZW+WMabid5WEUPg9eDjQh8nz2d2dTmc0fM+dALZgPHdlwnCALX9wa2E/iz2QDsV/Th
IOqyCguAQZIVNP18TI8W5RE7Mhj1/I/gOl3Tpzlsw6jIyklkLP48jE8/ruA+TugczrZ4vMRfWed5
VlRnzZfGX4yCVkVMv8TpBgp8lHGWgjPxjHV8fw9WDVaBs9Y1y7LUhLgB3IQ7cG3bx7+57c09ByyW
ecJMmKbZ6jo+rGgudd2548z9QOgal5dgnU/HHpj4776By0sDSHwPQwqLBfxy+/HjCH2r6iLlkwtc
ldOyKtZ1jorW2/UdVg0d4eKzYRpmnFbwQJOcFnc3GPndklXX3TIsy8c1DKMHPG6n7DSxl8aGSYTk
N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