[fpc-pascal]Password changing

Helio Cavichiolo Jr helio at definitylinux.com.br
Fri Jun 7 03:55:59 CEST 2002


Great Michael, but I don't know how to use yet.
Is there any special unit to install, or everything I need is in fpc full
package?
I've tried the following example, but it didn't compile.

Program Getpw;

Uses
  Linux;

var
  p: ^TPasswordRecord;

begin
  p := getpwnam('helio');
  writeln(p.pw_dir);
end.


On Thu, 6 Jun 2002, Michael Van Canneyt wrote:

> The correct way is to use get(s)pwnam()/put(s)pwnam() from the libc library.
>
> TPasswordRecord = record
>   pw_name : pchar;
>   pw_passwd : pchar;
>   pw_uid : pchar;
>   pw_gid : pchar;
>   pw_gecos : pchar;
>   pw_dir : pchar;
>   pw_shell : pchar;
> end;
> PPasswordRecord = ^TPasswordRecord;
>
> getpwnam (UserName : Pchar) : PPasswordRecord;cdecl;external 'c' name getpwnam;
>
> and similar for putpwnam.
>
> Do a man getpwent and you should get all possible info.
>
> Take care that systems with shadow passwords use getspwnam().
>
> Michael.
>
>
>
> _______________________________________________
> fpc-pascal maillist  -  fpc-pascal at lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal
>





More information about the fpc-pascal mailing list