* Moved users pkg, added makefile.fpc, and made it in general somewhat compilable.

Demo still fails due to crypt_h unit missing

git-svn-id: trunk@10008 -
This commit is contained in:
marco 2008-01-26 23:46:10 +00:00
parent 7152571786
commit ea2c789712
10 changed files with 2545 additions and 8 deletions

9
.gitattributes vendored
View File

@ -4370,11 +4370,14 @@ packages/unzip/fpmake.pp svneol=native#text/plain
packages/unzip/src/unzip.pp svneol=native#text/plain
packages/unzip/src/unzipdll.pp svneol=native#text/plain
packages/unzip/src/ziptypes.pp svneol=native#text/plain
packages/users/Makefile svneol=native#text/plain
packages/users/Makefile.fpc svneol=native#text/plain
packages/users/examples/testpass.pp svneol=native#text/plain
packages/users/examples/testuser.pp svneol=native#text/plain
packages/users/grp.pp svneol=native#text/plain
packages/users/pwd.pp svneol=native#text/plain
packages/users/shadow.pp svneol=native#text/plain
packages/users/fpmake.pp svneol=native#text/plain
packages/users/src/grp.pp svneol=native#text/plain
packages/users/src/pwd.pp svneol=native#text/plain
packages/users/src/shadow.pp svneol=native#text/plain
packages/users/src/users.pp svneol=native#text/plain
packages/uuid/Makefile svneol=native#text/plain
packages/uuid/Makefile.fpc svneol=native#text/plain

2465
packages/users/Makefile Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,30 @@
#
# Makefile.fpc for Users bindings
#
[package]
name=users
version=2.0.0
[target]
units=grp pwd shadow users
examples=testuser testpass
[require]
libc=y
[install]
fpcpackage=y
[default]
fpcdir=../..
[compiler]
includedir=src
sourcedir=src tests examples
[shared]
build=n
[rules]
.NOTPARALLEL:

View File

@ -3,7 +3,7 @@ Program TestPass;
{Test the user's password}
{$DEFINE DEBUG}
uses shadow, pwd, strings, crypt_h, cmem;
uses shadow, pwd, strings, {crypt_h,} cmem;
Var
strUserName, Password : String;

View File

@ -1,5 +1,5 @@
program testuser;
{$mode delphi}
uses users,classes;
var

39
packages/users/fpmake.pp Normal file
View File

@ -0,0 +1,39 @@
{$ifndef ALLPACKAGES}
{$mode objfpc}{$H+}
program fpmake;
uses fpmkunit;
Var
P : TPackage;
T : TTarget;
begin
With Installer do
begin
{$endif ALLPACKAGES}
P:=AddPackage('ibase');
{$ifdef ALLPACKAGES}
P.Directory:='ibase';
{$endif ALLPACKAGES}
P.Version:='2.0.0';
P.SourcePath.Add('src');
T:=P.Targets.AddUnit('ibase40.pp');
T:=P.Targets.AddUnit('ibase60dyn.pp');
with T.Dependencies do
begin
AddInclude('ibase60.inc');
end;
T:=P.Targets.AddUnit('ibase60.pp');
with T.Dependencies do
begin
AddInclude('ibase60.inc');
end;
{$ifndef ALLPACKAGES}
Run;
end;
end.
{$endif ALLPACKAGES}

View File

@ -1,8 +1,8 @@
unit users;
Interface
uses pwd,shadow,grp,Linux,SysUtils,Classes;
{$mode delphi}
uses baseunix,pwd,shadow,grp,SysUtils,Classes;
Type
EUserLookupError = Class(Exception);
@ -306,7 +306,7 @@ Var
begin
P:=getspnam(UserName);
If P=Nil then
If (GetUID<>0) and (GetEUID<>0) then
If (fpGetUID<>0) and (fpGetEUID<>0) then
Raise EShadowLookupError.Create(EShadowNotPermitted)
else
Raise EShadowLookupError.CreateFmt(ENoShadowEntry,[UserName])