mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-14 14:49:17 +02:00
* grp+pwd: freebsd+darwin compat. Attempt at fixing demoes unsuccesful.
git-svn-id: trunk@10163 -
This commit is contained in:
parent
28ebe338c4
commit
70ebb49af5
2
.gitattributes
vendored
2
.gitattributes
vendored
@ -4266,8 +4266,10 @@ packages/unzip/src/ziptypes.pp svneol=native#text/plain
|
|||||||
packages/users/Makefile svneol=native#text/plain
|
packages/users/Makefile svneol=native#text/plain
|
||||||
packages/users/Makefile.fpc svneol=native#text/plain
|
packages/users/Makefile.fpc svneol=native#text/plain
|
||||||
packages/users/examples/testpass.pp svneol=native#text/plain
|
packages/users/examples/testpass.pp svneol=native#text/plain
|
||||||
|
packages/users/examples/testpass2.pp svneol=native#text/plain
|
||||||
packages/users/examples/testuser.pp svneol=native#text/plain
|
packages/users/examples/testuser.pp svneol=native#text/plain
|
||||||
packages/users/fpmake.pp svneol=native#text/plain
|
packages/users/fpmake.pp svneol=native#text/plain
|
||||||
|
packages/users/src/crypth.pp svneol=native#text/plain
|
||||||
packages/users/src/grp.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/pwd.pp svneol=native#text/plain
|
||||||
packages/users/src/shadow.pp svneol=native#text/plain
|
packages/users/src/shadow.pp svneol=native#text/plain
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#
|
#
|
||||||
# Don't edit, this file is generated by FPCMake Version 2.0.0 [2008/01/26]
|
# Don't edit, this file is generated by FPCMake Version 2.0.0 [2008/02/02]
|
||||||
#
|
#
|
||||||
default: all
|
default: all
|
||||||
MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-netbsd i386-solaris i386-qnx i386-netware i386-openbsd i386-wdosx i386-darwin i386-emx i386-watcom i386-netwlibc i386-wince i386-embedded i386-symbian m68k-linux m68k-freebsd m68k-netbsd m68k-amiga m68k-atari m68k-openbsd m68k-palmos m68k-embedded powerpc-linux powerpc-netbsd powerpc-amiga powerpc-macos powerpc-darwin powerpc-morphos powerpc-embedded sparc-linux sparc-netbsd sparc-solaris sparc-embedded x86_64-linux x86_64-freebsd x86_64-darwin x86_64-win64 x86_64-embedded arm-linux arm-palmos arm-wince arm-gba arm-nds arm-embedded arm-symbian powerpc64-linux powerpc64-darwin powerpc64-embedded
|
MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-netbsd i386-solaris i386-qnx i386-netware i386-openbsd i386-wdosx i386-darwin i386-emx i386-watcom i386-netwlibc i386-wince i386-embedded i386-symbian m68k-linux m68k-freebsd m68k-netbsd m68k-amiga m68k-atari m68k-openbsd m68k-palmos m68k-embedded powerpc-linux powerpc-netbsd powerpc-amiga powerpc-macos powerpc-darwin powerpc-morphos powerpc-embedded sparc-linux sparc-netbsd sparc-solaris sparc-embedded x86_64-linux x86_64-freebsd x86_64-darwin x86_64-win64 x86_64-embedded arm-linux arm-palmos arm-wince arm-gba arm-nds arm-embedded arm-symbian powerpc64-linux powerpc64-darwin powerpc64-embedded
|
||||||
@ -243,322 +243,322 @@ PACKAGESDIR:=$(wildcard $(FPCDIR) $(FPCDIR)/packages $(FPCDIR)/packages/base $(F
|
|||||||
override PACKAGE_NAME=users
|
override PACKAGE_NAME=users
|
||||||
override PACKAGE_VERSION=2.0.0
|
override PACKAGE_VERSION=2.0.0
|
||||||
ifeq ($(FULL_TARGET),i386-linux)
|
ifeq ($(FULL_TARGET),i386-linux)
|
||||||
override TARGET_UNITS+=grp pwd shadow users
|
override TARGET_UNITS+=grp pwd users shadow crypth
|
||||||
endif
|
endif
|
||||||
ifeq ($(FULL_TARGET),i386-go32v2)
|
ifeq ($(FULL_TARGET),i386-go32v2)
|
||||||
override TARGET_UNITS+=grp pwd shadow users
|
override TARGET_UNITS+=grp pwd users
|
||||||
endif
|
endif
|
||||||
ifeq ($(FULL_TARGET),i386-win32)
|
ifeq ($(FULL_TARGET),i386-win32)
|
||||||
override TARGET_UNITS+=grp pwd shadow users
|
override TARGET_UNITS+=grp pwd users
|
||||||
endif
|
endif
|
||||||
ifeq ($(FULL_TARGET),i386-os2)
|
ifeq ($(FULL_TARGET),i386-os2)
|
||||||
override TARGET_UNITS+=grp pwd shadow users
|
override TARGET_UNITS+=grp pwd users
|
||||||
endif
|
endif
|
||||||
ifeq ($(FULL_TARGET),i386-freebsd)
|
ifeq ($(FULL_TARGET),i386-freebsd)
|
||||||
override TARGET_UNITS+=grp pwd shadow users
|
override TARGET_UNITS+=grp pwd users
|
||||||
endif
|
endif
|
||||||
ifeq ($(FULL_TARGET),i386-beos)
|
ifeq ($(FULL_TARGET),i386-beos)
|
||||||
override TARGET_UNITS+=grp pwd shadow users
|
override TARGET_UNITS+=grp pwd users
|
||||||
endif
|
endif
|
||||||
ifeq ($(FULL_TARGET),i386-netbsd)
|
ifeq ($(FULL_TARGET),i386-netbsd)
|
||||||
override TARGET_UNITS+=grp pwd shadow users
|
override TARGET_UNITS+=grp pwd users
|
||||||
endif
|
endif
|
||||||
ifeq ($(FULL_TARGET),i386-solaris)
|
ifeq ($(FULL_TARGET),i386-solaris)
|
||||||
override TARGET_UNITS+=grp pwd shadow users
|
override TARGET_UNITS+=grp pwd users
|
||||||
endif
|
endif
|
||||||
ifeq ($(FULL_TARGET),i386-qnx)
|
ifeq ($(FULL_TARGET),i386-qnx)
|
||||||
override TARGET_UNITS+=grp pwd shadow users
|
override TARGET_UNITS+=grp pwd users
|
||||||
endif
|
endif
|
||||||
ifeq ($(FULL_TARGET),i386-netware)
|
ifeq ($(FULL_TARGET),i386-netware)
|
||||||
override TARGET_UNITS+=grp pwd shadow users
|
override TARGET_UNITS+=grp pwd users
|
||||||
endif
|
endif
|
||||||
ifeq ($(FULL_TARGET),i386-openbsd)
|
ifeq ($(FULL_TARGET),i386-openbsd)
|
||||||
override TARGET_UNITS+=grp pwd shadow users
|
override TARGET_UNITS+=grp pwd users
|
||||||
endif
|
endif
|
||||||
ifeq ($(FULL_TARGET),i386-wdosx)
|
ifeq ($(FULL_TARGET),i386-wdosx)
|
||||||
override TARGET_UNITS+=grp pwd shadow users
|
override TARGET_UNITS+=grp pwd users
|
||||||
endif
|
endif
|
||||||
ifeq ($(FULL_TARGET),i386-darwin)
|
ifeq ($(FULL_TARGET),i386-darwin)
|
||||||
override TARGET_UNITS+=grp pwd shadow users
|
override TARGET_UNITS+=grp pwd users
|
||||||
endif
|
endif
|
||||||
ifeq ($(FULL_TARGET),i386-emx)
|
ifeq ($(FULL_TARGET),i386-emx)
|
||||||
override TARGET_UNITS+=grp pwd shadow users
|
override TARGET_UNITS+=grp pwd users
|
||||||
endif
|
endif
|
||||||
ifeq ($(FULL_TARGET),i386-watcom)
|
ifeq ($(FULL_TARGET),i386-watcom)
|
||||||
override TARGET_UNITS+=grp pwd shadow users
|
override TARGET_UNITS+=grp pwd users
|
||||||
endif
|
endif
|
||||||
ifeq ($(FULL_TARGET),i386-netwlibc)
|
ifeq ($(FULL_TARGET),i386-netwlibc)
|
||||||
override TARGET_UNITS+=grp pwd shadow users
|
override TARGET_UNITS+=grp pwd users
|
||||||
endif
|
endif
|
||||||
ifeq ($(FULL_TARGET),i386-wince)
|
ifeq ($(FULL_TARGET),i386-wince)
|
||||||
override TARGET_UNITS+=grp pwd shadow users
|
override TARGET_UNITS+=grp pwd users
|
||||||
endif
|
endif
|
||||||
ifeq ($(FULL_TARGET),i386-embedded)
|
ifeq ($(FULL_TARGET),i386-embedded)
|
||||||
override TARGET_UNITS+=grp pwd shadow users
|
override TARGET_UNITS+=grp pwd users
|
||||||
endif
|
endif
|
||||||
ifeq ($(FULL_TARGET),i386-symbian)
|
ifeq ($(FULL_TARGET),i386-symbian)
|
||||||
override TARGET_UNITS+=grp pwd shadow users
|
override TARGET_UNITS+=grp pwd users
|
||||||
endif
|
endif
|
||||||
ifeq ($(FULL_TARGET),m68k-linux)
|
ifeq ($(FULL_TARGET),m68k-linux)
|
||||||
override TARGET_UNITS+=grp pwd shadow users
|
override TARGET_UNITS+=grp pwd users shadow crypth
|
||||||
endif
|
endif
|
||||||
ifeq ($(FULL_TARGET),m68k-freebsd)
|
ifeq ($(FULL_TARGET),m68k-freebsd)
|
||||||
override TARGET_UNITS+=grp pwd shadow users
|
override TARGET_UNITS+=grp pwd users
|
||||||
endif
|
endif
|
||||||
ifeq ($(FULL_TARGET),m68k-netbsd)
|
ifeq ($(FULL_TARGET),m68k-netbsd)
|
||||||
override TARGET_UNITS+=grp pwd shadow users
|
override TARGET_UNITS+=grp pwd users
|
||||||
endif
|
endif
|
||||||
ifeq ($(FULL_TARGET),m68k-amiga)
|
ifeq ($(FULL_TARGET),m68k-amiga)
|
||||||
override TARGET_UNITS+=grp pwd shadow users
|
override TARGET_UNITS+=grp pwd users
|
||||||
endif
|
endif
|
||||||
ifeq ($(FULL_TARGET),m68k-atari)
|
ifeq ($(FULL_TARGET),m68k-atari)
|
||||||
override TARGET_UNITS+=grp pwd shadow users
|
override TARGET_UNITS+=grp pwd users
|
||||||
endif
|
endif
|
||||||
ifeq ($(FULL_TARGET),m68k-openbsd)
|
ifeq ($(FULL_TARGET),m68k-openbsd)
|
||||||
override TARGET_UNITS+=grp pwd shadow users
|
override TARGET_UNITS+=grp pwd users
|
||||||
endif
|
endif
|
||||||
ifeq ($(FULL_TARGET),m68k-palmos)
|
ifeq ($(FULL_TARGET),m68k-palmos)
|
||||||
override TARGET_UNITS+=grp pwd shadow users
|
override TARGET_UNITS+=grp pwd users
|
||||||
endif
|
endif
|
||||||
ifeq ($(FULL_TARGET),m68k-embedded)
|
ifeq ($(FULL_TARGET),m68k-embedded)
|
||||||
override TARGET_UNITS+=grp pwd shadow users
|
override TARGET_UNITS+=grp pwd users
|
||||||
endif
|
endif
|
||||||
ifeq ($(FULL_TARGET),powerpc-linux)
|
ifeq ($(FULL_TARGET),powerpc-linux)
|
||||||
override TARGET_UNITS+=grp pwd shadow users
|
override TARGET_UNITS+=grp pwd users shadow crypth
|
||||||
endif
|
endif
|
||||||
ifeq ($(FULL_TARGET),powerpc-netbsd)
|
ifeq ($(FULL_TARGET),powerpc-netbsd)
|
||||||
override TARGET_UNITS+=grp pwd shadow users
|
override TARGET_UNITS+=grp pwd users
|
||||||
endif
|
endif
|
||||||
ifeq ($(FULL_TARGET),powerpc-amiga)
|
ifeq ($(FULL_TARGET),powerpc-amiga)
|
||||||
override TARGET_UNITS+=grp pwd shadow users
|
override TARGET_UNITS+=grp pwd users
|
||||||
endif
|
endif
|
||||||
ifeq ($(FULL_TARGET),powerpc-macos)
|
ifeq ($(FULL_TARGET),powerpc-macos)
|
||||||
override TARGET_UNITS+=grp pwd shadow users
|
override TARGET_UNITS+=grp pwd users
|
||||||
endif
|
endif
|
||||||
ifeq ($(FULL_TARGET),powerpc-darwin)
|
ifeq ($(FULL_TARGET),powerpc-darwin)
|
||||||
override TARGET_UNITS+=grp pwd shadow users
|
override TARGET_UNITS+=grp pwd users
|
||||||
endif
|
endif
|
||||||
ifeq ($(FULL_TARGET),powerpc-morphos)
|
ifeq ($(FULL_TARGET),powerpc-morphos)
|
||||||
override TARGET_UNITS+=grp pwd shadow users
|
override TARGET_UNITS+=grp pwd users
|
||||||
endif
|
endif
|
||||||
ifeq ($(FULL_TARGET),powerpc-embedded)
|
ifeq ($(FULL_TARGET),powerpc-embedded)
|
||||||
override TARGET_UNITS+=grp pwd shadow users
|
override TARGET_UNITS+=grp pwd users
|
||||||
endif
|
endif
|
||||||
ifeq ($(FULL_TARGET),sparc-linux)
|
ifeq ($(FULL_TARGET),sparc-linux)
|
||||||
override TARGET_UNITS+=grp pwd shadow users
|
override TARGET_UNITS+=grp pwd users shadow crypth
|
||||||
endif
|
endif
|
||||||
ifeq ($(FULL_TARGET),sparc-netbsd)
|
ifeq ($(FULL_TARGET),sparc-netbsd)
|
||||||
override TARGET_UNITS+=grp pwd shadow users
|
override TARGET_UNITS+=grp pwd users
|
||||||
endif
|
endif
|
||||||
ifeq ($(FULL_TARGET),sparc-solaris)
|
ifeq ($(FULL_TARGET),sparc-solaris)
|
||||||
override TARGET_UNITS+=grp pwd shadow users
|
override TARGET_UNITS+=grp pwd users
|
||||||
endif
|
endif
|
||||||
ifeq ($(FULL_TARGET),sparc-embedded)
|
ifeq ($(FULL_TARGET),sparc-embedded)
|
||||||
override TARGET_UNITS+=grp pwd shadow users
|
override TARGET_UNITS+=grp pwd users
|
||||||
endif
|
endif
|
||||||
ifeq ($(FULL_TARGET),x86_64-linux)
|
ifeq ($(FULL_TARGET),x86_64-linux)
|
||||||
override TARGET_UNITS+=grp pwd shadow users
|
override TARGET_UNITS+=grp pwd users shadow crypth
|
||||||
endif
|
endif
|
||||||
ifeq ($(FULL_TARGET),x86_64-freebsd)
|
ifeq ($(FULL_TARGET),x86_64-freebsd)
|
||||||
override TARGET_UNITS+=grp pwd shadow users
|
override TARGET_UNITS+=grp pwd users
|
||||||
endif
|
endif
|
||||||
ifeq ($(FULL_TARGET),x86_64-darwin)
|
ifeq ($(FULL_TARGET),x86_64-darwin)
|
||||||
override TARGET_UNITS+=grp pwd shadow users
|
override TARGET_UNITS+=grp pwd users
|
||||||
endif
|
endif
|
||||||
ifeq ($(FULL_TARGET),x86_64-win64)
|
ifeq ($(FULL_TARGET),x86_64-win64)
|
||||||
override TARGET_UNITS+=grp pwd shadow users
|
override TARGET_UNITS+=grp pwd users
|
||||||
endif
|
endif
|
||||||
ifeq ($(FULL_TARGET),x86_64-embedded)
|
ifeq ($(FULL_TARGET),x86_64-embedded)
|
||||||
override TARGET_UNITS+=grp pwd shadow users
|
override TARGET_UNITS+=grp pwd users
|
||||||
endif
|
endif
|
||||||
ifeq ($(FULL_TARGET),arm-linux)
|
ifeq ($(FULL_TARGET),arm-linux)
|
||||||
override TARGET_UNITS+=grp pwd shadow users
|
override TARGET_UNITS+=grp pwd users shadow crypth
|
||||||
endif
|
endif
|
||||||
ifeq ($(FULL_TARGET),arm-palmos)
|
ifeq ($(FULL_TARGET),arm-palmos)
|
||||||
override TARGET_UNITS+=grp pwd shadow users
|
override TARGET_UNITS+=grp pwd users
|
||||||
endif
|
endif
|
||||||
ifeq ($(FULL_TARGET),arm-wince)
|
ifeq ($(FULL_TARGET),arm-wince)
|
||||||
override TARGET_UNITS+=grp pwd shadow users
|
override TARGET_UNITS+=grp pwd users
|
||||||
endif
|
endif
|
||||||
ifeq ($(FULL_TARGET),arm-gba)
|
ifeq ($(FULL_TARGET),arm-gba)
|
||||||
override TARGET_UNITS+=grp pwd shadow users
|
override TARGET_UNITS+=grp pwd users
|
||||||
endif
|
endif
|
||||||
ifeq ($(FULL_TARGET),arm-nds)
|
ifeq ($(FULL_TARGET),arm-nds)
|
||||||
override TARGET_UNITS+=grp pwd shadow users
|
override TARGET_UNITS+=grp pwd users
|
||||||
endif
|
endif
|
||||||
ifeq ($(FULL_TARGET),arm-embedded)
|
ifeq ($(FULL_TARGET),arm-embedded)
|
||||||
override TARGET_UNITS+=grp pwd shadow users
|
override TARGET_UNITS+=grp pwd users
|
||||||
endif
|
endif
|
||||||
ifeq ($(FULL_TARGET),arm-symbian)
|
ifeq ($(FULL_TARGET),arm-symbian)
|
||||||
override TARGET_UNITS+=grp pwd shadow users
|
override TARGET_UNITS+=grp pwd users
|
||||||
endif
|
endif
|
||||||
ifeq ($(FULL_TARGET),powerpc64-linux)
|
ifeq ($(FULL_TARGET),powerpc64-linux)
|
||||||
override TARGET_UNITS+=grp pwd shadow users
|
override TARGET_UNITS+=grp pwd users shadow crypth
|
||||||
endif
|
endif
|
||||||
ifeq ($(FULL_TARGET),powerpc64-darwin)
|
ifeq ($(FULL_TARGET),powerpc64-darwin)
|
||||||
override TARGET_UNITS+=grp pwd shadow users
|
override TARGET_UNITS+=grp pwd users
|
||||||
endif
|
endif
|
||||||
ifeq ($(FULL_TARGET),powerpc64-embedded)
|
ifeq ($(FULL_TARGET),powerpc64-embedded)
|
||||||
override TARGET_UNITS+=grp pwd shadow users
|
override TARGET_UNITS+=grp pwd users
|
||||||
endif
|
endif
|
||||||
ifeq ($(FULL_TARGET),i386-linux)
|
ifeq ($(FULL_TARGET),i386-linux)
|
||||||
override TARGET_EXAMPLES+=testuser testpass
|
override TARGET_EXAMPLES+=testuser testpass2 testpass
|
||||||
endif
|
endif
|
||||||
ifeq ($(FULL_TARGET),i386-go32v2)
|
ifeq ($(FULL_TARGET),i386-go32v2)
|
||||||
override TARGET_EXAMPLES+=testuser testpass
|
override TARGET_EXAMPLES+=testuser testpass2
|
||||||
endif
|
endif
|
||||||
ifeq ($(FULL_TARGET),i386-win32)
|
ifeq ($(FULL_TARGET),i386-win32)
|
||||||
override TARGET_EXAMPLES+=testuser testpass
|
override TARGET_EXAMPLES+=testuser testpass2
|
||||||
endif
|
endif
|
||||||
ifeq ($(FULL_TARGET),i386-os2)
|
ifeq ($(FULL_TARGET),i386-os2)
|
||||||
override TARGET_EXAMPLES+=testuser testpass
|
override TARGET_EXAMPLES+=testuser testpass2
|
||||||
endif
|
endif
|
||||||
ifeq ($(FULL_TARGET),i386-freebsd)
|
ifeq ($(FULL_TARGET),i386-freebsd)
|
||||||
override TARGET_EXAMPLES+=testuser testpass
|
override TARGET_EXAMPLES+=testuser testpass2
|
||||||
endif
|
endif
|
||||||
ifeq ($(FULL_TARGET),i386-beos)
|
ifeq ($(FULL_TARGET),i386-beos)
|
||||||
override TARGET_EXAMPLES+=testuser testpass
|
override TARGET_EXAMPLES+=testuser testpass2
|
||||||
endif
|
endif
|
||||||
ifeq ($(FULL_TARGET),i386-netbsd)
|
ifeq ($(FULL_TARGET),i386-netbsd)
|
||||||
override TARGET_EXAMPLES+=testuser testpass
|
override TARGET_EXAMPLES+=testuser testpass2
|
||||||
endif
|
endif
|
||||||
ifeq ($(FULL_TARGET),i386-solaris)
|
ifeq ($(FULL_TARGET),i386-solaris)
|
||||||
override TARGET_EXAMPLES+=testuser testpass
|
override TARGET_EXAMPLES+=testuser testpass2
|
||||||
endif
|
endif
|
||||||
ifeq ($(FULL_TARGET),i386-qnx)
|
ifeq ($(FULL_TARGET),i386-qnx)
|
||||||
override TARGET_EXAMPLES+=testuser testpass
|
override TARGET_EXAMPLES+=testuser testpass2
|
||||||
endif
|
endif
|
||||||
ifeq ($(FULL_TARGET),i386-netware)
|
ifeq ($(FULL_TARGET),i386-netware)
|
||||||
override TARGET_EXAMPLES+=testuser testpass
|
override TARGET_EXAMPLES+=testuser testpass2
|
||||||
endif
|
endif
|
||||||
ifeq ($(FULL_TARGET),i386-openbsd)
|
ifeq ($(FULL_TARGET),i386-openbsd)
|
||||||
override TARGET_EXAMPLES+=testuser testpass
|
override TARGET_EXAMPLES+=testuser testpass2
|
||||||
endif
|
endif
|
||||||
ifeq ($(FULL_TARGET),i386-wdosx)
|
ifeq ($(FULL_TARGET),i386-wdosx)
|
||||||
override TARGET_EXAMPLES+=testuser testpass
|
override TARGET_EXAMPLES+=testuser testpass2
|
||||||
endif
|
endif
|
||||||
ifeq ($(FULL_TARGET),i386-darwin)
|
ifeq ($(FULL_TARGET),i386-darwin)
|
||||||
override TARGET_EXAMPLES+=testuser testpass
|
override TARGET_EXAMPLES+=testuser testpass2
|
||||||
endif
|
endif
|
||||||
ifeq ($(FULL_TARGET),i386-emx)
|
ifeq ($(FULL_TARGET),i386-emx)
|
||||||
override TARGET_EXAMPLES+=testuser testpass
|
override TARGET_EXAMPLES+=testuser testpass2
|
||||||
endif
|
endif
|
||||||
ifeq ($(FULL_TARGET),i386-watcom)
|
ifeq ($(FULL_TARGET),i386-watcom)
|
||||||
override TARGET_EXAMPLES+=testuser testpass
|
override TARGET_EXAMPLES+=testuser testpass2
|
||||||
endif
|
endif
|
||||||
ifeq ($(FULL_TARGET),i386-netwlibc)
|
ifeq ($(FULL_TARGET),i386-netwlibc)
|
||||||
override TARGET_EXAMPLES+=testuser testpass
|
override TARGET_EXAMPLES+=testuser testpass2
|
||||||
endif
|
endif
|
||||||
ifeq ($(FULL_TARGET),i386-wince)
|
ifeq ($(FULL_TARGET),i386-wince)
|
||||||
override TARGET_EXAMPLES+=testuser testpass
|
override TARGET_EXAMPLES+=testuser testpass2
|
||||||
endif
|
endif
|
||||||
ifeq ($(FULL_TARGET),i386-embedded)
|
ifeq ($(FULL_TARGET),i386-embedded)
|
||||||
override TARGET_EXAMPLES+=testuser testpass
|
override TARGET_EXAMPLES+=testuser testpass2
|
||||||
endif
|
endif
|
||||||
ifeq ($(FULL_TARGET),i386-symbian)
|
ifeq ($(FULL_TARGET),i386-symbian)
|
||||||
override TARGET_EXAMPLES+=testuser testpass
|
override TARGET_EXAMPLES+=testuser testpass2
|
||||||
endif
|
endif
|
||||||
ifeq ($(FULL_TARGET),m68k-linux)
|
ifeq ($(FULL_TARGET),m68k-linux)
|
||||||
override TARGET_EXAMPLES+=testuser testpass
|
override TARGET_EXAMPLES+=testuser testpass2 testpass
|
||||||
endif
|
endif
|
||||||
ifeq ($(FULL_TARGET),m68k-freebsd)
|
ifeq ($(FULL_TARGET),m68k-freebsd)
|
||||||
override TARGET_EXAMPLES+=testuser testpass
|
override TARGET_EXAMPLES+=testuser testpass2
|
||||||
endif
|
endif
|
||||||
ifeq ($(FULL_TARGET),m68k-netbsd)
|
ifeq ($(FULL_TARGET),m68k-netbsd)
|
||||||
override TARGET_EXAMPLES+=testuser testpass
|
override TARGET_EXAMPLES+=testuser testpass2
|
||||||
endif
|
endif
|
||||||
ifeq ($(FULL_TARGET),m68k-amiga)
|
ifeq ($(FULL_TARGET),m68k-amiga)
|
||||||
override TARGET_EXAMPLES+=testuser testpass
|
override TARGET_EXAMPLES+=testuser testpass2
|
||||||
endif
|
endif
|
||||||
ifeq ($(FULL_TARGET),m68k-atari)
|
ifeq ($(FULL_TARGET),m68k-atari)
|
||||||
override TARGET_EXAMPLES+=testuser testpass
|
override TARGET_EXAMPLES+=testuser testpass2
|
||||||
endif
|
endif
|
||||||
ifeq ($(FULL_TARGET),m68k-openbsd)
|
ifeq ($(FULL_TARGET),m68k-openbsd)
|
||||||
override TARGET_EXAMPLES+=testuser testpass
|
override TARGET_EXAMPLES+=testuser testpass2
|
||||||
endif
|
endif
|
||||||
ifeq ($(FULL_TARGET),m68k-palmos)
|
ifeq ($(FULL_TARGET),m68k-palmos)
|
||||||
override TARGET_EXAMPLES+=testuser testpass
|
override TARGET_EXAMPLES+=testuser testpass2
|
||||||
endif
|
endif
|
||||||
ifeq ($(FULL_TARGET),m68k-embedded)
|
ifeq ($(FULL_TARGET),m68k-embedded)
|
||||||
override TARGET_EXAMPLES+=testuser testpass
|
override TARGET_EXAMPLES+=testuser testpass2
|
||||||
endif
|
endif
|
||||||
ifeq ($(FULL_TARGET),powerpc-linux)
|
ifeq ($(FULL_TARGET),powerpc-linux)
|
||||||
override TARGET_EXAMPLES+=testuser testpass
|
override TARGET_EXAMPLES+=testuser testpass2 testpass
|
||||||
endif
|
endif
|
||||||
ifeq ($(FULL_TARGET),powerpc-netbsd)
|
ifeq ($(FULL_TARGET),powerpc-netbsd)
|
||||||
override TARGET_EXAMPLES+=testuser testpass
|
override TARGET_EXAMPLES+=testuser testpass2
|
||||||
endif
|
endif
|
||||||
ifeq ($(FULL_TARGET),powerpc-amiga)
|
ifeq ($(FULL_TARGET),powerpc-amiga)
|
||||||
override TARGET_EXAMPLES+=testuser testpass
|
override TARGET_EXAMPLES+=testuser testpass2
|
||||||
endif
|
endif
|
||||||
ifeq ($(FULL_TARGET),powerpc-macos)
|
ifeq ($(FULL_TARGET),powerpc-macos)
|
||||||
override TARGET_EXAMPLES+=testuser testpass
|
override TARGET_EXAMPLES+=testuser testpass2
|
||||||
endif
|
endif
|
||||||
ifeq ($(FULL_TARGET),powerpc-darwin)
|
ifeq ($(FULL_TARGET),powerpc-darwin)
|
||||||
override TARGET_EXAMPLES+=testuser testpass
|
override TARGET_EXAMPLES+=testuser testpass2
|
||||||
endif
|
endif
|
||||||
ifeq ($(FULL_TARGET),powerpc-morphos)
|
ifeq ($(FULL_TARGET),powerpc-morphos)
|
||||||
override TARGET_EXAMPLES+=testuser testpass
|
override TARGET_EXAMPLES+=testuser testpass2
|
||||||
endif
|
endif
|
||||||
ifeq ($(FULL_TARGET),powerpc-embedded)
|
ifeq ($(FULL_TARGET),powerpc-embedded)
|
||||||
override TARGET_EXAMPLES+=testuser testpass
|
override TARGET_EXAMPLES+=testuser testpass2
|
||||||
endif
|
endif
|
||||||
ifeq ($(FULL_TARGET),sparc-linux)
|
ifeq ($(FULL_TARGET),sparc-linux)
|
||||||
override TARGET_EXAMPLES+=testuser testpass
|
override TARGET_EXAMPLES+=testuser testpass2 testpass
|
||||||
endif
|
endif
|
||||||
ifeq ($(FULL_TARGET),sparc-netbsd)
|
ifeq ($(FULL_TARGET),sparc-netbsd)
|
||||||
override TARGET_EXAMPLES+=testuser testpass
|
override TARGET_EXAMPLES+=testuser testpass2
|
||||||
endif
|
endif
|
||||||
ifeq ($(FULL_TARGET),sparc-solaris)
|
ifeq ($(FULL_TARGET),sparc-solaris)
|
||||||
override TARGET_EXAMPLES+=testuser testpass
|
override TARGET_EXAMPLES+=testuser testpass2
|
||||||
endif
|
endif
|
||||||
ifeq ($(FULL_TARGET),sparc-embedded)
|
ifeq ($(FULL_TARGET),sparc-embedded)
|
||||||
override TARGET_EXAMPLES+=testuser testpass
|
override TARGET_EXAMPLES+=testuser testpass2
|
||||||
endif
|
endif
|
||||||
ifeq ($(FULL_TARGET),x86_64-linux)
|
ifeq ($(FULL_TARGET),x86_64-linux)
|
||||||
override TARGET_EXAMPLES+=testuser testpass
|
override TARGET_EXAMPLES+=testuser testpass2 testpass
|
||||||
endif
|
endif
|
||||||
ifeq ($(FULL_TARGET),x86_64-freebsd)
|
ifeq ($(FULL_TARGET),x86_64-freebsd)
|
||||||
override TARGET_EXAMPLES+=testuser testpass
|
override TARGET_EXAMPLES+=testuser testpass2
|
||||||
endif
|
endif
|
||||||
ifeq ($(FULL_TARGET),x86_64-darwin)
|
ifeq ($(FULL_TARGET),x86_64-darwin)
|
||||||
override TARGET_EXAMPLES+=testuser testpass
|
override TARGET_EXAMPLES+=testuser testpass2
|
||||||
endif
|
endif
|
||||||
ifeq ($(FULL_TARGET),x86_64-win64)
|
ifeq ($(FULL_TARGET),x86_64-win64)
|
||||||
override TARGET_EXAMPLES+=testuser testpass
|
override TARGET_EXAMPLES+=testuser testpass2
|
||||||
endif
|
endif
|
||||||
ifeq ($(FULL_TARGET),x86_64-embedded)
|
ifeq ($(FULL_TARGET),x86_64-embedded)
|
||||||
override TARGET_EXAMPLES+=testuser testpass
|
override TARGET_EXAMPLES+=testuser testpass2
|
||||||
endif
|
endif
|
||||||
ifeq ($(FULL_TARGET),arm-linux)
|
ifeq ($(FULL_TARGET),arm-linux)
|
||||||
override TARGET_EXAMPLES+=testuser testpass
|
override TARGET_EXAMPLES+=testuser testpass2 testpass
|
||||||
endif
|
endif
|
||||||
ifeq ($(FULL_TARGET),arm-palmos)
|
ifeq ($(FULL_TARGET),arm-palmos)
|
||||||
override TARGET_EXAMPLES+=testuser testpass
|
override TARGET_EXAMPLES+=testuser testpass2
|
||||||
endif
|
endif
|
||||||
ifeq ($(FULL_TARGET),arm-wince)
|
ifeq ($(FULL_TARGET),arm-wince)
|
||||||
override TARGET_EXAMPLES+=testuser testpass
|
override TARGET_EXAMPLES+=testuser testpass2
|
||||||
endif
|
endif
|
||||||
ifeq ($(FULL_TARGET),arm-gba)
|
ifeq ($(FULL_TARGET),arm-gba)
|
||||||
override TARGET_EXAMPLES+=testuser testpass
|
override TARGET_EXAMPLES+=testuser testpass2
|
||||||
endif
|
endif
|
||||||
ifeq ($(FULL_TARGET),arm-nds)
|
ifeq ($(FULL_TARGET),arm-nds)
|
||||||
override TARGET_EXAMPLES+=testuser testpass
|
override TARGET_EXAMPLES+=testuser testpass2
|
||||||
endif
|
endif
|
||||||
ifeq ($(FULL_TARGET),arm-embedded)
|
ifeq ($(FULL_TARGET),arm-embedded)
|
||||||
override TARGET_EXAMPLES+=testuser testpass
|
override TARGET_EXAMPLES+=testuser testpass2
|
||||||
endif
|
endif
|
||||||
ifeq ($(FULL_TARGET),arm-symbian)
|
ifeq ($(FULL_TARGET),arm-symbian)
|
||||||
override TARGET_EXAMPLES+=testuser testpass
|
override TARGET_EXAMPLES+=testuser testpass2
|
||||||
endif
|
endif
|
||||||
ifeq ($(FULL_TARGET),powerpc64-linux)
|
ifeq ($(FULL_TARGET),powerpc64-linux)
|
||||||
override TARGET_EXAMPLES+=testuser testpass
|
override TARGET_EXAMPLES+=testuser testpass2 testpass
|
||||||
endif
|
endif
|
||||||
ifeq ($(FULL_TARGET),powerpc64-darwin)
|
ifeq ($(FULL_TARGET),powerpc64-darwin)
|
||||||
override TARGET_EXAMPLES+=testuser testpass
|
override TARGET_EXAMPLES+=testuser testpass2
|
||||||
endif
|
endif
|
||||||
ifeq ($(FULL_TARGET),powerpc64-embedded)
|
ifeq ($(FULL_TARGET),powerpc64-embedded)
|
||||||
override TARGET_EXAMPLES+=testuser testpass
|
override TARGET_EXAMPLES+=testuser testpass2
|
||||||
endif
|
endif
|
||||||
override INSTALL_FPCPACKAGE=y
|
override INSTALL_FPCPACKAGE=y
|
||||||
ifeq ($(FULL_TARGET),i386-linux)
|
ifeq ($(FULL_TARGET),i386-linux)
|
||||||
|
@ -7,8 +7,10 @@ name=users
|
|||||||
version=2.0.0
|
version=2.0.0
|
||||||
|
|
||||||
[target]
|
[target]
|
||||||
units=grp pwd shadow users
|
units=grp pwd users
|
||||||
examples=testuser testpass
|
units_linux=shadow crypth
|
||||||
|
examples=testuser testpass2
|
||||||
|
examples_linux=testpass
|
||||||
|
|
||||||
[require]
|
[require]
|
||||||
libc=y
|
libc=y
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
Program TestPass;
|
Program TestPass;
|
||||||
|
{$mode delphi}
|
||||||
{Test the user's password}
|
{Test the user's password}
|
||||||
{$DEFINE DEBUG}
|
{$DEFINE DEBUG}
|
||||||
|
|
||||||
uses shadow, pwd, strings, {crypt_h,} cmem;
|
// The funcs in shadow are linux only.
|
||||||
|
uses {$ifdef linux}shadow, {$endif} pwd ,crypth ;
|
||||||
|
|
||||||
Var
|
Var
|
||||||
strUserName, Password : String;
|
strUserName, Password : String;
|
||||||
@ -30,7 +31,7 @@ Begin
|
|||||||
{$IFDEF DEBUG}
|
{$IFDEF DEBUG}
|
||||||
Writeln('No shadow entry');
|
Writeln('No shadow entry');
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
pEntry := getpwnam(A);
|
pEntry := fpgetpwnam(A);
|
||||||
If pEntry = nil then
|
If pEntry = nil then
|
||||||
Begin
|
Begin
|
||||||
{$IFDEF DEBUG}
|
{$IFDEF DEBUG}
|
||||||
@ -78,7 +79,7 @@ Begin
|
|||||||
Writeln('Salt is : ',PCSalt);
|
Writeln('Salt is : ',PCSalt);
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
PCResult := crypt(PCPass, PCSalt);
|
PCResult := crypt(PCPass, PCSalt);
|
||||||
ResultPass := StrPas(PCResult);
|
ResultPass := PCResult;
|
||||||
{$IFDEF DEBUG}
|
{$IFDEF DEBUG}
|
||||||
Writeln('From passwd/shadow : ',EncPass);
|
Writeln('From passwd/shadow : ',EncPass);
|
||||||
Writeln('From crypt : ',ResultPass);
|
Writeln('From crypt : ',ResultPass);
|
||||||
|
56
packages/users/examples/testpass2.pp
Normal file
56
packages/users/examples/testpass2.pp
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
Program TestPass2;
|
||||||
|
|
||||||
|
Uses pwd,grp,baseunix;
|
||||||
|
|
||||||
|
Procedure printpchar(fieldname:String;p:pchar);
|
||||||
|
|
||||||
|
Begin
|
||||||
|
If assigned(p) Then
|
||||||
|
Begin
|
||||||
|
write(fieldname);
|
||||||
|
write(':',' ':15-length(fieldname));
|
||||||
|
writeln(p);
|
||||||
|
End;
|
||||||
|
End;
|
||||||
|
|
||||||
|
Var p : PPasswd;
|
||||||
|
supplementary_gids : array[0..99] Of gid_t;
|
||||||
|
i,nrgids: cint;
|
||||||
|
pgrp: PGroup;
|
||||||
|
|
||||||
|
Begin
|
||||||
|
p := fpgetpwnam('marcov');
|
||||||
|
If assigned(p) Then
|
||||||
|
Begin
|
||||||
|
printpchar('pw_name',p^.pw_name);
|
||||||
|
printpchar('pw_passwd',p^.pw_passwd);
|
||||||
|
writeln('pw_uid:',' ':9,p^.pw_uid);
|
||||||
|
writeln('pw_gid:',' ':9,p^.pw_gid);
|
||||||
|
{$ifdef BSD}
|
||||||
|
printpchar('pw_change',p^.pw_change);
|
||||||
|
printpchar('pw_class',p^.pw_class);
|
||||||
|
{$endif}
|
||||||
|
printpchar('pw_gecos',p^.pw_gecos);
|
||||||
|
printpchar('pw_dir',p^.pw_dir);
|
||||||
|
printpchar('pw_shell',p^.pw_shell);
|
||||||
|
{$ifdef BSD}
|
||||||
|
printpchar('pw_expire',p^.pw_expire);
|
||||||
|
printpchar('pw_fields',p^.pw_fields);
|
||||||
|
{$endif}
|
||||||
|
End;
|
||||||
|
nrgids := 100;
|
||||||
|
If fpgetgrouplist(p^.pw_name,p^.pw_gid,@supplementary_gids,@nrgids)<>-1 Then
|
||||||
|
Begin
|
||||||
|
Write ('Supplementary groups:');
|
||||||
|
For i:=0 To nrgids-1 Do
|
||||||
|
Begin
|
||||||
|
pgrp := fpgetgrgid(supplementary_gids[i]);
|
||||||
|
If assigned(pgrp) Then
|
||||||
|
write(pgrp^.gr_name,' (',supplementary_gids[i],') ')
|
||||||
|
Else
|
||||||
|
write(' ???? (',supplementary_gids[i],') ')
|
||||||
|
End;
|
||||||
|
writeln;
|
||||||
|
End;
|
||||||
|
writeln;
|
||||||
|
End.
|
14
packages/users/src/crypth.pp
Normal file
14
packages/users/src/crypth.pp
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
unit crypth;
|
||||||
|
|
||||||
|
interface
|
||||||
|
|
||||||
|
uses BaseUnix,initc;
|
||||||
|
|
||||||
|
{$ifdef Linux}{$linklib crypt}{$endif}
|
||||||
|
|
||||||
|
Const libname ={$ifdef Linux}'crypt'{$else}clib{$endif};
|
||||||
|
|
||||||
|
function crypt(key,salt:pchar):pchar;cdecl; external libname name 'crypt';
|
||||||
|
|
||||||
|
implementation
|
||||||
|
end.
|
@ -1,64 +1,59 @@
|
|||||||
unit grp;
|
unit grp;
|
||||||
|
|
||||||
interface
|
interface
|
||||||
|
|
||||||
{
|
uses
|
||||||
Automatically converted by H2Pas 0.99.15 from grp.h
|
initc,baseunix,ctypes;
|
||||||
The following command line parameters were used:
|
|
||||||
-D
|
|
||||||
-l
|
|
||||||
c
|
|
||||||
-p
|
|
||||||
-s
|
|
||||||
-u
|
|
||||||
grp
|
|
||||||
-v
|
|
||||||
grp.h
|
|
||||||
}
|
|
||||||
|
|
||||||
const
|
|
||||||
External_library='c'; {Setup as you need}
|
|
||||||
|
|
||||||
{ Pointers to basic pascal types, inserted by h2pas conversion program.}
|
|
||||||
Type
|
|
||||||
PLongint = ^Longint;
|
|
||||||
PSmallInt = ^SmallInt;
|
|
||||||
PByte = ^Byte;
|
|
||||||
PWord = ^Word;
|
|
||||||
PDWord = ^DWord;
|
|
||||||
PDouble = ^Double;
|
|
||||||
|
|
||||||
|
{$IFDEF FPC}
|
||||||
{$PACKRECORDS C}
|
{$PACKRECORDS C}
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
|
const
|
||||||
|
External_library= clib; {Setup as you need}
|
||||||
|
|
||||||
|
_PATH_GROUP = '/etc/group';
|
||||||
|
|
||||||
|
Type
|
||||||
|
|
||||||
|
PGroup = ^TGroup;
|
||||||
|
PPGroup = ^PGroup;
|
||||||
|
TGroup = record
|
||||||
|
gr_name : pchar; { group name }
|
||||||
|
gr_passwd : pchar; { group password }
|
||||||
|
gr_gid : gid_t; { group id }
|
||||||
|
gr_mem : ppchar; { group members }
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
type
|
procedure fpendgrent; cdecl;external External_library name 'endgrent';
|
||||||
PFILE = Pointer;
|
function fpgetgrent:pgroup; cdecl;external External_library name 'getgrent';
|
||||||
__gid_t = Longint;
|
function fpgetgrgid (id:gid_t):pgroup; cdecl;external External_library name 'getgrgid';
|
||||||
P__gid_t = ^__gid_t;
|
function fpgetgrnam (name:pchar):pgroup; cdecl;external External_library name 'getgrnam';
|
||||||
size_t = longint;
|
{$ifdef BSD}
|
||||||
|
function fpgroup_from_gid (gid:gid_t; nogrup:cint):pchar; cdecl;external External_library name 'group_from_gid';
|
||||||
|
{$endif}
|
||||||
|
|
||||||
PGroup = ^group;
|
function fpsetgrent:cint;cdecl;external External_library name 'setgrent';
|
||||||
group = record
|
|
||||||
gr_name : Pchar;
|
|
||||||
gr_passwd : Pchar;
|
|
||||||
gr_gid : __gid_t;
|
|
||||||
gr_mem : ^Pchar;
|
|
||||||
end;
|
|
||||||
TGroup = Group;
|
|
||||||
PPGROUP = ^PGroup;
|
|
||||||
|
|
||||||
procedure setgrent;cdecl;external External_library name 'setgrent';
|
function fpgetgrgid_r (id:gid_t; grp:Pgroup; buffer:pchar; buffersize:size_t; grresult:PPgroup):cint;cdecl;external External_library name 'getgrgid_r';
|
||||||
procedure endgrent;cdecl;external External_library name 'endgrent';
|
|
||||||
function getgrent:Pgroup;cdecl;external External_library name 'getgrent';
|
|
||||||
function fgetgrent(__stream:PFILE):Pgroup;cdecl;external External_library name 'fgetgrent';
|
|
||||||
function getgrgid(__gid:__gid_t):Pgroup;cdecl;external External_library name 'getgrgid';
|
|
||||||
function getgrnam(__name:Pchar):Pgroup;cdecl;external External_library name 'getgrnam';
|
|
||||||
function getgrgid_r(__gid:__gid_t; __resultbuf:Pgroup; __buffer:Pchar; __buflen:size_t; __result:PPgroup):longint;cdecl;external External_library name 'getgrgid_r';
|
|
||||||
function getgrnam_r(__name:Pchar; __resultbuf:Pgroup; __buffer:Pchar; __buflen:size_t; __result:PPgroup):longint;cdecl;external External_library name 'getgrnam_r';
|
|
||||||
function fgetgrent_r(__stream:PFILE; __resultbuf:Pgroup; __buffer:Pchar; __buflen:size_t; __result:PPgroup):longint;cdecl;external External_library name 'fgetgrent_r';
|
|
||||||
function setgroups(__n:size_t; __groups:P__gid_t):longint;cdecl;external External_library name 'setgroups';
|
|
||||||
function getgrouplist(__user:Pchar; __group:__gid_t; __groups:P__gid_t; __ngroups:Plongint):longint;cdecl;external External_library name 'getgrouplist';
|
|
||||||
function initgroups(__user:Pchar; __group:__gid_t):longint;cdecl;external External_library name 'initgroups';
|
|
||||||
|
|
||||||
|
function fpgetgrnam_r (nam:pchar; grp:Pgroup; buffer:pchar; buffersize:size_t; grresult:PPgroup):cint;cdecl;external External_library name 'getgrnam_r';
|
||||||
|
{$ifndef Darwin}
|
||||||
|
function fpgetgrent_r (grp:Pgroup; buffer:pchar; buffersize:size_t; grresult:PPgroup):cint;cdecl;external External_library name 'getgrent_r';
|
||||||
|
{$endif}
|
||||||
|
|
||||||
|
function fpsetgroupent (stayopen:cint):cint;cdecl;external External_library name 'setgroupent';
|
||||||
|
|
||||||
|
{$ifdef Darwin}
|
||||||
|
procedure fpsetgrfile(name:pchar); cdecl; external external_library name 'setgrfile';
|
||||||
|
{$endif}
|
||||||
|
|
||||||
|
// FreeBSD has these, Linux too if USE_BSD is defined. Darwin too.
|
||||||
|
// Darwin uses ints instead of gid's though, except for setgroups.
|
||||||
|
function fpsetgroups(n:size_t;groups:pgid):cint; cdecl; external External_Library name 'setgroups';
|
||||||
|
function fpgetgrouplist(user:pchar;group:tgid;groups:pgid;ngroups:pcint):cint; cdecl; external External_Library name 'getgrouplist';
|
||||||
|
function fpinitgroups(user:pchar;group:tgid):cint;cdecl; external External_Library name 'initgroups';
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
|
@ -1,64 +1,139 @@
|
|||||||
unit pwd;
|
unit pwd;
|
||||||
|
|
||||||
interface
|
interface
|
||||||
|
|
||||||
{
|
uses
|
||||||
Automatically converted by H2Pas 0.99.15 from pwd.H
|
initc,baseunix,ctypes;
|
||||||
The following command line parameters were used:
|
|
||||||
-D
|
{$IFDEF FPC}
|
||||||
-l
|
{$PACKRECORDS C}
|
||||||
c
|
{$ENDIF}
|
||||||
-p
|
|
||||||
-s
|
|
||||||
-u
|
|
||||||
pwd
|
|
||||||
-v
|
|
||||||
pwd.H
|
|
||||||
}
|
|
||||||
|
|
||||||
const
|
const
|
||||||
External_library='c'; {Setup as you need}
|
External_library= clib; {Setup as you need}
|
||||||
|
|
||||||
{ Pointers to basic pascal types, inserted by h2pas conversion program.}
|
const
|
||||||
Type
|
_PATH_PWD = '/etc';
|
||||||
PLongint = ^Longint;
|
_PATH_PASSWD = '/etc/passwd';
|
||||||
PSmallInt = ^SmallInt;
|
_PASSWD = 'passwd';
|
||||||
PByte = ^Byte;
|
_PATH_MASTERPASSWD = '/etc/master.passwd';
|
||||||
PWord = ^Word;
|
{$ifdef Darwin}
|
||||||
PDWord = ^DWord;
|
_PATH_MASTERPASSWD_LOCK = '/etc/ptmp';
|
||||||
PDouble = ^Double;
|
{$endif}
|
||||||
|
_MASTERPASSWD = 'master.passwd';
|
||||||
|
|
||||||
{$PACKRECORDS C}
|
_PATH_MP_DB = '/etc/pwd.db';
|
||||||
|
_MP_DB = 'pwd.db';
|
||||||
|
_PATH_SMP_DB = '/etc/spwd.db';
|
||||||
|
_SMP_DB = 'spwd.db';
|
||||||
|
_PATH_PWD_MKDB = '/usr/sbin/pwd_mkdb';
|
||||||
|
|
||||||
|
|
||||||
|
{$ifdef BSD}
|
||||||
|
_PW_VERSION_MASK = #$F0;
|
||||||
|
|
||||||
|
function _PW_VERSIONED(x,v : longint) : cuchar; inline;
|
||||||
|
|
||||||
|
|
||||||
|
const
|
||||||
|
_PW_KEYBYNAME = #$31; { stored by name }
|
||||||
|
_PW_KEYBYNUM = #$32; { stored by entry in the "file"}
|
||||||
|
_PW_KEYBYUID = #$33; { stored by uid }
|
||||||
|
{$ifdef FreeBSD}
|
||||||
|
_PW_KEYYPENABLED = #$34; { YP is enabled }
|
||||||
|
_PW_KEYYPBYNUM = #$35; { special +@netgroup entries }
|
||||||
|
{$endif}
|
||||||
|
|
||||||
|
{ The database also contains a key to indicate the format version of
|
||||||
|
* the entries therein. There may be other, older versioned entries
|
||||||
|
* as well. }
|
||||||
|
|
||||||
|
const
|
||||||
|
{$ifdef FreeBSD}
|
||||||
|
_PWD_VERSION_KEY = #$FF+'VERSION';
|
||||||
|
_PWD_CURRENT_VERSION = #$4;
|
||||||
|
{$endif}
|
||||||
|
_PASSWORD_EFMT1 = '_'; { extended encryption format }
|
||||||
|
_PASSWORD_LEN = 128; { max length, not counting NULL }
|
||||||
|
{$ifdef Darwin}
|
||||||
|
_PASSWORD_NOUID = $01; (* flag for no specified uid. *)
|
||||||
|
_PASSWORD_NOGID = $02; (* flag for no specified gid. *)
|
||||||
|
_PASSWORD_NOCHG = $04; (* flag for no specified change. *)
|
||||||
|
_PASSWORD_NOEXP =$08; (* flag for no specified expire. *)
|
||||||
|
_PASSWORD_WARNDAYS = 14; (* days to warn about expiry *)
|
||||||
|
_PASSWORD_CHGNOW = -1; (* special day to force password
|
||||||
|
* change at next login *)
|
||||||
|
{$endif}
|
||||||
|
|
||||||
|
{$endif}
|
||||||
|
|
||||||
type
|
type
|
||||||
PFile = Pointer;
|
{ Darwin uses __darwin_time_t, but that is an alias for time_t }
|
||||||
__uid_t = longint;
|
PPasswd = ^TPasswd;
|
||||||
__gid_t = longint;
|
PPPasswd = ^PPasswd;
|
||||||
|
Passwd = record
|
||||||
|
pw_name : pchar; { user name }
|
||||||
|
pw_passwd : pchar; { encrypted password }
|
||||||
|
pw_uid : Tuid; { user uid }
|
||||||
|
pw_gid : Tgid; { user gid }
|
||||||
|
{$ifdef bsd}
|
||||||
|
pw_change : Ttime platform; { password change time }
|
||||||
|
pw_class : pchar platform; { user access class }
|
||||||
|
{$endif}
|
||||||
|
pw_gecos : pchar; { Honeywell login info }
|
||||||
|
pw_dir : pchar; { home directory }
|
||||||
|
pw_shell : pchar; { default shell }
|
||||||
|
{$ifdef bsd}
|
||||||
|
pw_expire : Ttime platform; { account expiration }
|
||||||
|
{$ifdef FreeBSD}
|
||||||
|
pw_fields : cint platform; { internal: fields filled in }
|
||||||
|
{$endif}
|
||||||
|
{$endif}
|
||||||
|
end;
|
||||||
|
TPasswd = Passwd;
|
||||||
|
|
||||||
Ppasswd = ^passwd;
|
|
||||||
passwd = record
|
|
||||||
pw_name : Pchar;
|
|
||||||
pw_passwd : Pchar;
|
|
||||||
pw_uid : __uid_t;
|
|
||||||
pw_gid : __gid_t;
|
|
||||||
pw_gecos : Pchar;
|
|
||||||
pw_dir : Pchar;
|
|
||||||
pw_shell : Pchar;
|
|
||||||
end;
|
|
||||||
TPasswordRecord = passwd;
|
|
||||||
PPasswordRecord = ^TPasswordRecord;
|
|
||||||
|
|
||||||
procedure setpwent;cdecl; external External_library name 'setpwent';
|
{$ifdef FreeBSD}
|
||||||
procedure endpwent;cdecl; external External_library name 'endpwent';
|
const
|
||||||
function getpwent:Ppasswd;cdecl;external External_library name 'getpwent';
|
_PWF_NAME = 1;
|
||||||
function fgetpwent(__stream:PFILE):Ppasswd;cdecl;external External_library name 'fgetpwent';
|
_PWF_PASSWD = 2;
|
||||||
function putpwent(__p:Ppasswd; __f:PFILE):longint;cdecl;external External_library name 'putpwent';
|
_PWF_UID = 4;
|
||||||
function getpwuid(__uid:__uid_t):Ppasswd;cdecl;external External_library name 'getpwuid';
|
_PWF_GID = 8;
|
||||||
function getpwnam(__name:Pchar):Ppasswd;cdecl;external External_library name 'getpwnam';
|
_PWF_CHANGE = $10;
|
||||||
function getpw(__uid:__uid_t; __buffer:Pchar):longint;cdecl;external External_library name 'getpw';
|
_PWF_CLASS = $20;
|
||||||
|
_PWF_GECOS = $40;
|
||||||
|
_PWF_DIR = $80;
|
||||||
|
_PWF_SHELL = $100;
|
||||||
|
_PWF_EXPIRE = $200;
|
||||||
|
|
||||||
|
|
||||||
|
_PWF_SOURCE = $3000;
|
||||||
|
_PWF_FILES = $1000;
|
||||||
|
_PWF_NIS = $2000;
|
||||||
|
_PWF_HESIOD = $3000;
|
||||||
|
{$endif}
|
||||||
|
|
||||||
|
function fpgetpwnam (name:pchar):PPasswd; cdecl;external External_library name 'getpwnam';
|
||||||
|
function fpgetpwuid (id:tuid):PPasswd;cdecl;external External_library name 'getpwuid';
|
||||||
|
|
||||||
|
procedure fpendpwent;cdecl;external External_library name 'endpwent';
|
||||||
|
function fpgetpwent:ppasswd;cdecl;external External_library name 'getpwent';
|
||||||
|
procedure fpsetpwent;cdecl;external External_library name 'setpwent';
|
||||||
|
|
||||||
|
function fpgetpwnam_r (namepara1:pchar; pwd:Ppasswd; buffer:pchar; bufsize:size_t; pwresult:PPpasswd):cint;cdecl;external External_library name 'getpwnam_r';
|
||||||
|
function fpgetpwuid_r (uid:uid_t; pwd:Ppasswd; buffer:pchar; buffersize:size_t; pwresult:PPpasswd):cint;cdecl;external External_library name 'getpwuid_r';
|
||||||
|
{$ifndef Darwin}
|
||||||
|
function fpgetpwent_r (pwd:Ppasswd; buffer:pchar; buffersize:size_t; pwresult:PPpasswd):cint;cdecl;external External_library name 'getpwent_r';
|
||||||
|
{$endif}
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
|
{$ifdef BSD}
|
||||||
|
function _PW_VERSIONED (x,v : longint) : cuchar; inline;
|
||||||
|
|
||||||
|
begin
|
||||||
|
_PW_VERSIONED:= (x and $CF) or (v shl 4);
|
||||||
|
end;
|
||||||
|
{$endif}
|
||||||
|
|
||||||
end.
|
end.
|
||||||
|
@ -2,21 +2,23 @@ unit users;
|
|||||||
|
|
||||||
Interface
|
Interface
|
||||||
{$mode delphi}
|
{$mode delphi}
|
||||||
uses baseunix,pwd,shadow,grp,SysUtils,Classes;
|
uses BaseUnix,pwd,grp, {$ifdef Linux} shadow{$endif},SysUtils,Classes;
|
||||||
|
|
||||||
Type
|
Type
|
||||||
EUserLookupError = Class(Exception);
|
EUserLookupError = Class(Exception);
|
||||||
EGroupLookupError = Class(Exception);
|
EGroupLookupError = Class(Exception);
|
||||||
EShadowLookupError = Class(Exception);
|
EShadowLookupError = Class(Exception);
|
||||||
|
TPasswordRecord = Tpasswd;
|
||||||
|
PPasswordRecord = ^TPasswordRecord;
|
||||||
|
|
||||||
{ User functions }
|
{ User functions }
|
||||||
|
|
||||||
Function getpwnam(Const UserName: String) : PPasswordRecord;
|
Function getpwnam(Const UserName: String) : PPasswordRecord;
|
||||||
Procedure GetUserData(Const UserName : String; Var Data : TPasswordRecord); overload;
|
Procedure GetUserData(Const UserName : String; Var Data : TPasswordRecord); overload;
|
||||||
Procedure GetUserData(Uid : Integer; Var Data : TPasswordRecord); overload;
|
Procedure GetUserData(Uid : TUID; Var Data : TPasswordRecord); overload;
|
||||||
function GetUserName(UID : Integer) : String;
|
function GetUserName(UID : TUID) : String;
|
||||||
function GetUserId(Const UserName : String) : Integer;
|
function GetUserId(Const UserName : String) : TUID;
|
||||||
function GetUserGid(Const UserName : String) : Integer;
|
function GetUserGid(Const UserName : String) : TGID;
|
||||||
function GetUserDir(Const UserName : String): String;
|
function GetUserDir(Const UserName : String): String;
|
||||||
function GetUserDescription(Const UserName : String): String;
|
function GetUserDescription(Const UserName : String): String;
|
||||||
Procedure GetUserList(List : Tstrings);overload;
|
Procedure GetUserList(List : Tstrings);overload;
|
||||||
@ -26,20 +28,23 @@ Procedure GetUserList(List : TStrings; WithIDs : Boolean);overload;
|
|||||||
|
|
||||||
Function getgrnam(Const GroupName: String) : PGroup;
|
Function getgrnam(Const GroupName: String) : PGroup;
|
||||||
Procedure GetGroupData(Const GroupName : String; Var Data : TGroup); overload;
|
Procedure GetGroupData(Const GroupName : String; Var Data : TGroup); overload;
|
||||||
Procedure GetGroupData(Gid : Integer; Var Data : TGroup); overload;
|
Procedure GetGroupData(Gid : TGID; Var Data : TGroup); overload;
|
||||||
function GetGroupName(GID : Integer) : String;
|
function GetGroupName(GID : TGID) : String;
|
||||||
function GetGroupId(Const GroupName : String) : Integer;
|
function GetGroupId(Const GroupName : String) : TGID;
|
||||||
Procedure GetGroupList(List : Tstrings);overload;
|
Procedure GetGroupList(List : Tstrings);overload;
|
||||||
Procedure GetGroupList(List : TStrings; WithIDs : Boolean);overload;
|
Procedure GetGroupList(List : TStrings; WithIDs : Boolean);overload;
|
||||||
Procedure GetGroupMembers(GID : Integer;List : TStrings);overload;
|
Procedure GetGroupMembers(GID : TGID;List : TStrings);overload;
|
||||||
Procedure GetGroupMembers(Const GroupName : String;List : TStrings);overload;
|
Procedure GetGroupMembers(Const GroupName : String;List : TStrings);overload;
|
||||||
|
|
||||||
{ Shadow password functions }
|
{ Shadow password functions }
|
||||||
|
|
||||||
|
{$ifdef Linux}
|
||||||
function getspnam(UserName : String): PPasswordFileEntry;
|
function getspnam(UserName : String): PPasswordFileEntry;
|
||||||
function sgetspent(Line : String): PPasswordFileEntry;
|
function sgetspent(Line : String): PPasswordFileEntry;
|
||||||
|
|
||||||
Procedure GetUserShadowData(Const UserName : String; Var Data : TPasswordFileEntry);overload;
|
Procedure GetUserShadowData(Const UserName : String; Var Data : TPasswordFileEntry);overload;
|
||||||
Procedure GetUserShadowData(UID : Integer; Var Data : TPasswordFileEntry);overload;
|
Procedure GetUserShadowData(UID : TUID; Var Data : TPasswordFileEntry);overload;
|
||||||
|
{$endif}
|
||||||
|
|
||||||
{ Extra functions }
|
{ Extra functions }
|
||||||
|
|
||||||
@ -59,7 +64,7 @@ EShadowNotPermitted = 'Not enough permissions to access shadow password file';
|
|||||||
Function getpwnam(Const UserName: String) : PPasswordRecord;
|
Function getpwnam(Const UserName: String) : PPasswordRecord;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
Result:=pwd.getpwnam(Pchar(UserName));
|
Result:=pwd.fpgetpwnam(Pchar(UserName));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
Procedure GetUserData(Const UserName : String; Var Data : TPasswordRecord);
|
Procedure GetUserData(Const UserName : String; Var Data : TPasswordRecord);
|
||||||
@ -67,36 +72,36 @@ Procedure GetUserData(Const UserName : String; Var Data : TPasswordRecord);
|
|||||||
Var P : PPasswordRecord;
|
Var P : PPasswordRecord;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
P:=Getpwnam(UserName);
|
P:=fpGetpwnam(pchar(UserName));
|
||||||
If P<>Nil then
|
If P<>Nil then
|
||||||
Data:=P^
|
Data:=P^
|
||||||
else
|
else
|
||||||
Raise EUserLookupError.CreateFmt(ENoSuchUserName,[UserName]);
|
Raise EUserLookupError.CreateFmt(ENoSuchUserName,[UserName]);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
Procedure GetUserData(Uid : Integer; Var Data : TPasswordRecord);
|
Procedure GetUserData(Uid : tuid; Var Data : TPasswordRecord);
|
||||||
|
|
||||||
Var P : PPasswordRecord;
|
Var P : PPasswordRecord;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
P:=Getpwuid(Uid);
|
P:=fpGetpwuid(Uid);
|
||||||
If P<>Nil then
|
If P<>Nil then
|
||||||
Data:=P^
|
Data:=P^
|
||||||
else
|
else
|
||||||
Raise EUserLookupError.CreateFmt(ENoSuchUserID,[Uid]);
|
Raise EUserLookupError.CreateFmt(ENoSuchUserID,[Uid]);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function GetUserName(UID : Integer) : String;
|
function GetUserName(UID : TUID) : String;
|
||||||
|
|
||||||
Var
|
Var
|
||||||
UserData : TPasswordRecord;
|
UserData : TPasswordRecord;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
GetuserData(UID,UserData);
|
GetuserData(UID,UserData);
|
||||||
Result:=strpas(UserData.pw_Name);
|
Result:=UserData.pw_Name;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function GetUserId(Const UserName : String) : Integer;
|
function GetUserId(Const UserName : String) : TUID;
|
||||||
|
|
||||||
Var
|
Var
|
||||||
UserData : TPasswordRecord;
|
UserData : TPasswordRecord;
|
||||||
@ -106,7 +111,7 @@ begin
|
|||||||
Result:=UserData.pw_uid;
|
Result:=UserData.pw_uid;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function GetUserGId(Const UserName : String) : Integer;
|
function GetUserGId(Const UserName : String) : TGID;
|
||||||
|
|
||||||
Var
|
Var
|
||||||
UserData : TPasswordRecord;
|
UserData : TPasswordRecord;
|
||||||
@ -123,7 +128,7 @@ Var
|
|||||||
|
|
||||||
begin
|
begin
|
||||||
GetUserData(UserName,UserData);
|
GetUserData(UserName,UserData);
|
||||||
Result:=strpas(UserData.pw_dir);
|
Result:=UserData.pw_dir;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function GetUserDescription(Const UserName : String): String;
|
function GetUserDescription(Const UserName : String): String;
|
||||||
@ -149,10 +154,10 @@ Var
|
|||||||
|
|
||||||
begin
|
begin
|
||||||
List.Clear;
|
List.Clear;
|
||||||
setpwent;
|
fpsetpwent;
|
||||||
try
|
try
|
||||||
Repeat
|
Repeat
|
||||||
P:=getpwent;
|
P:=fpgetpwent;
|
||||||
If P<>Nil then
|
If P<>Nil then
|
||||||
begin
|
begin
|
||||||
If WithIDs then
|
If WithIDs then
|
||||||
@ -162,7 +167,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
until (P=Nil);
|
until (P=Nil);
|
||||||
finally
|
finally
|
||||||
endpwent;
|
fpendpwent;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -174,7 +179,7 @@ end;
|
|||||||
Function getgrnam(Const GroupName: String) : PGroup;
|
Function getgrnam(Const GroupName: String) : PGroup;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
Result:=grp.getgrnam(Pchar(GroupName));
|
Result:=grp.fpgetgrnam(Pchar(GroupName));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
Procedure GetGroupData(Const GroupName : String; Var Data : TGroup); overload;
|
Procedure GetGroupData(Const GroupName : String; Var Data : TGroup); overload;
|
||||||
@ -182,36 +187,36 @@ Procedure GetGroupData(Const GroupName : String; Var Data : TGroup); overload;
|
|||||||
Var P : PGroup;
|
Var P : PGroup;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
P:=Getgrnam(GroupName);
|
P:=fpGetgrnam(pchar(GroupName));
|
||||||
If P<>Nil then
|
If P<>Nil then
|
||||||
Data:=P^
|
Data:=P^
|
||||||
else
|
else
|
||||||
Raise EGroupLookupError.CreateFmt(ENoSuchGroupName,[GroupName]);
|
Raise EGroupLookupError.CreateFmt(ENoSuchGroupName,[GroupName]);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
Procedure GetGroupData(Gid : Integer; Var Data : TGroup); overload;
|
Procedure GetGroupData(Gid : TGID; Var Data : TGroup); overload;
|
||||||
|
|
||||||
Var P : PGroup;
|
Var P : PGroup;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
P:=Getgrgid(gid);
|
P:=fpGetgrgid(gid);
|
||||||
If P<>Nil then
|
If P<>Nil then
|
||||||
Data:=P^
|
Data:=P^
|
||||||
else
|
else
|
||||||
Raise EGroupLookupError.CreateFmt(ENoSuchGroupID,[Gid]);
|
Raise EGroupLookupError.CreateFmt(ENoSuchGroupID,[Gid]);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function GetGroupName(GID : Integer) : String;
|
function GetGroupName(GID : TGID) : String;
|
||||||
|
|
||||||
Var
|
Var
|
||||||
G : TGroup;
|
G : TGroup;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
GetGroupData(Gid,G);
|
GetGroupData(Gid,G);
|
||||||
Result:=StrPas(G.gr_name);
|
Result:=G.gr_name;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function GetGroupId(Const GroupName : String) : Integer;
|
function GetGroupId(Const GroupName : String) : TGID;
|
||||||
|
|
||||||
Var
|
Var
|
||||||
G : TGroup;
|
G : TGroup;
|
||||||
@ -234,10 +239,10 @@ Var
|
|||||||
|
|
||||||
begin
|
begin
|
||||||
List.Clear;
|
List.Clear;
|
||||||
setgrent;
|
fpsetgrent;
|
||||||
try
|
try
|
||||||
Repeat
|
Repeat
|
||||||
G:=getgrent;
|
G:=fpgetgrent;
|
||||||
If G<>Nil then
|
If G<>Nil then
|
||||||
begin
|
begin
|
||||||
If WithIDs then
|
If WithIDs then
|
||||||
@ -247,7 +252,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
until (G=Nil);
|
until (G=Nil);
|
||||||
finally
|
finally
|
||||||
endgrent;
|
fpendgrent;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -264,7 +269,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
Procedure GetGroupMembers(GID : Integer;List : TStrings);
|
Procedure GetGroupMembers(GID : TGID;List : TStrings);
|
||||||
|
|
||||||
Var
|
Var
|
||||||
G : TGroup;
|
G : TGroup;
|
||||||
@ -285,7 +290,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
{ Shadow password functions }
|
{ Shadow password functions }
|
||||||
|
{$ifdef linux}
|
||||||
function getspnam(UserName : String): PPasswordFileEntry;
|
function getspnam(UserName : String): PPasswordFileEntry;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
@ -314,12 +319,13 @@ begin
|
|||||||
Data:=P^;
|
Data:=P^;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
Procedure GetUserShadowData(UID : Integer; Var Data : TPasswordFileEntry);
|
|
||||||
|
Procedure GetUserShadowData(UID : TUID; Var Data : TPasswordFileEntry);
|
||||||
|
|
||||||
begin
|
begin
|
||||||
GetUserShadowData(GetUserName(UID),Data);
|
GetUserShadowData(GetUserName(UID),Data);
|
||||||
end;
|
end;
|
||||||
|
{$endif}
|
||||||
{ Extra functions }
|
{ Extra functions }
|
||||||
|
|
||||||
Function GetUserGroup(Const UserName : String) : String;
|
Function GetUserGroup(Const UserName : String) : String;
|
||||||
|
Loading…
Reference in New Issue
Block a user