1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-03-09 15:50:02 +00:00

Add PAM support to dtsession.

This commit is contained in:
Liang Chang 2021-01-31 02:14:34 +08:00 committed by Jon Trulson
parent 085c8bdc37
commit f13fdec2fb
4 changed files with 54 additions and 3 deletions

View file

@ -4,6 +4,12 @@ DEPEND_DEFINES = $(DEPENDDEFINES)
DEFINES = -DCDE_INSTALLATION_TOP=\"$(CDE_INSTALLATION_TOP)\" \ DEFINES = -DCDE_INSTALLATION_TOP=\"$(CDE_INSTALLATION_TOP)\" \
-DCDE_CONFIGURATION_TOP=\"$(CDE_CONFIGURATION_TOP)\" -DCDE_CONFIGURATION_TOP=\"$(CDE_CONFIGURATION_TOP)\"
#if defined(HasPamLibrary) && HasPamLibrary
DTPAMSVCLIB = -lDtPamSvc
#else
DTPAMSVCLIB =
#endif
#if defined(SunArchitecture) #if defined(SunArchitecture)
DEPLIBS = $(DEPDTWIDGETLIB) $(DEPDTSVCLIB) $(DEPTTLIB) \ DEPLIBS = $(DEPDTWIDGETLIB) $(DEPDTSVCLIB) $(DEPTTLIB) \
$(DEPXMLIB) $(DEPXTOOLLIB) $(DEPXLIB) $(DEPXMLIB) $(DEPXTOOLLIB) $(DEPXLIB)
@ -13,7 +19,7 @@ LOCAL_LIBRARIES = $(DTWIDGETLIB) $(DTSVCLIB) $(TTLIB) \
DEPLIBS = $(DEPDTHELPLIB) $(DEPDTWIDGETLIB) $(DEPDTSVCLIB) $(DEPTTLIB) \ DEPLIBS = $(DEPDTHELPLIB) $(DEPDTWIDGETLIB) $(DEPDTSVCLIB) $(DEPTTLIB) \
$(DEPXMLIB) $(DEPXTOOLLIB) $(DEPXLIB) $(DEPXMLIB) $(DEPXTOOLLIB) $(DEPXLIB)
LOCAL_LIBRARIES = $(DTHELPLIB) $(DTWIDGETLIB) $(DTSVCLIB) $(TTLIB) \ LOCAL_LIBRARIES = $(DTHELPLIB) $(DTWIDGETLIB) $(DTSVCLIB) $(TTLIB) \
$(XMLIB) $(XTOOLLIB) $(USE_XHPLIB) $(XLIB) $(XMLIB) $(XTOOLLIB) $(USE_XHPLIB) $(XLIB) $(DTPAMSVCLIB)
#endif /* SunArchitecture */ #endif /* SunArchitecture */
SYS_LIBRARIES = -lm SYS_LIBRARIES = -lm
@ -62,6 +68,10 @@ EXTRA_DEFINES = -D${PROGRAMS} $(XINOPT) -DUSE_X11SSEXT
SYS_LIBRARIES = $(XINLIB) -lXss -lcrypt -lm SYS_LIBRARIES = $(XINLIB) -lXss -lcrypt -lm
#endif #endif
#if defined(HasPamLibrary) && HasPamLibrary
EXTRA_DEFINES += -DHAS_PAM_LIBRARY
#endif
PROGRAMS=dtsession PROGRAMS=dtsession
/**** Every .o except version.o may only be built in a remote /**** Every .o except version.o may only be built in a remote

View file

@ -85,6 +85,10 @@
#include <pwd.h> #include <pwd.h>
#endif #endif
#ifdef HAS_PAM_LIBRARY
#include <PamSvc.h>
#endif
#include "Sm.h" #include "Sm.h"
#include "SmGlobals.h" #include "SmGlobals.h"
#include "SmUI.h" #include "SmUI.h"
@ -1602,7 +1606,22 @@ localAuthenticate(
char *name, char *name,
uid_t uid, uid_t uid,
char *passwd ) char *passwd )
#ifdef SIA #if defined(HAS_PAM_LIBRARY)
{
char *service;
struct passwd *pwent;
if (!(name || passwd)) return True;
if (!passwd) return False;
if (!(pwent = name ? getpwnam(name) : getpwuid(uid))) return False;
endpwent();
if (!(service = strrchr(smGD.programName, '/'))) return False;
return !_DtAuthentication(service + 1, NULL, passwd, pwent->pw_name, NULL);
}
#elif defined(SIA)
@ -1962,4 +1981,3 @@ Authenticate(
return(arc == 0 ? True : False); return(arc == 0 ? True : False);
} }
#endif /* _AIX && _POWER */ #endif /* _AIX && _POWER */

View file

@ -0,0 +1,13 @@
#if defined(HasPamLibrary) && HasPamLibrary
LOCAL_CPP_DEFINES = -DHAS_PAM_LIBRARY
#ifdef PamAuthenticationModule
PAM_AUTHENTICATION_MODULE=PamAuthenticationModule
LOCAL_CPP_DEFINES += -DPAM_AUTHENTICATION_MODULE=$(PAM_AUTHENTICATION_MODULE)
#endif
CPP_TARGETS = dtsession.pam.conf
AllTarget($(CPP_TARGETS))
CppSourceFile(dtsession.pam.conf,dtsession.pam.conf.src,$(LOCAL_CPP_DEFINES),)
#endif

View file

@ -0,0 +1,10 @@
#ifdef PAM_AUTHENTICATION_MODULE
auth sufficient PAM_AUTHENTICATION_MODULE
#endif
auth required pam_unix.so
account required pam_deny.so
session required pam_deny.so
password required pam_deny.so