Re: [PATCH app-xdm 2/9] config: upgrade the checking for PAM support

2010-11-23 Thread Gaetan Nadon
On Mon, 2010-11-22 at 10:32 -0800, Alan Coopersmith wrote:

  -# ifdef USE_PAM
  +# ifdef HAVE_PAM_OPEN_SESSION
 
 USE_PAM really does seem more descriptive in this case than
 HAVE_PAM_OPEN_SESSION though, since it's the whole framework
 we care about (and a build-time option to disable), not just
 the presence of one function.
 

I see. Using the presence of a function to determine the presence of a
feature.
Version 2 does not replace USE_PAM.

I also changed check for SELinux to be consistent, patch #3 version 2.


signature.asc
Description: This is a digitally signed message part
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

[PATCH app-xdm 2/9] config: upgrade the checking for PAM support

2010-11-22 Thread Gaetan Nadon
Use AC_CHECK_FUNCS to get the consistent #define HAVE_xxx
Use auto rather than try for consistency with other modules.
Update help string to mention default value.
Unchanged: if configured --with-pam and -lpam is misisng,
abort the configuration.

Signed-off-by: Gaetan Nadon mems...@videotron.ca
---
 configure.ac |   20 ++--
 dm.h |4 ++--
 greet.h  |6 +++---
 greeter/Login.h  |2 +-
 greeter/greet.c  |   22 +++---
 greeter/verify.c |8 
 session.c|   22 +++---
 7 files changed, 42 insertions(+), 42 deletions(-)

diff --git a/configure.ac b/configure.ac
index e2e15f6..3e6bc01 100644
--- a/configure.ac
+++ b/configure.ac
@@ -119,17 +119,17 @@ AC_CHECK_DECL(key_setnet,
 #include rpc/key_prot.h
 ])
 
-# Check for PAM support
-use_pam_default=try
-AC_ARG_WITH(pam, AC_HELP_STRING([--with-pam],[Use PAM for authentication]),
-   [USE_PAM=$withval], [USE_PAM=$use_pam_default])
+# Check for pluggable authentication modules (PAM) support
+AC_ARG_WITH(pam, AS_HELP_STRING([--with-pam],
+   [Use PAM for authentication (default is autodected)]),
+   [USE_PAM=$withval], [USE_PAM=auto])
 if test x$USE_PAM != xno ; then
-   AC_SEARCH_LIBS(pam_open_session,[pam])
-   AC_CHECK_FUNC(pam_open_session, 
-   [AC_DEFINE(USE_PAM,1,[Use PAM for authentication])],
-   [if test x$USE_PAM != xtry ; then
-   AC_MSG_ERROR([PAM support requested, but 
pam_open_session not found.])
-fi])
+AC_SEARCH_LIBS([pam_open_session], [pam],
+   [AC_CHECK_FUNCS([pam_open_session])],
+   [AS_IF([test x$USE_PAM = xyes],
+   [AC_MSG_ERROR([PAM support requested, but pam_open_session not 
found.])]
+   )]
+)
 fi
 
 use_selinux_default=no
diff --git a/dm.h b/dm.h
index 6633248..7c67906 100644
--- a/dm.h
+++ b/dm.h
@@ -104,7 +104,7 @@ typedef union wait  waitType;
 #  endif
 # endif /* X_NOT_POSIX */
 
-# ifdef USE_PAM
+# ifdef HAVE_PAM_OPEN_SESSION
 #  include security/pam_appl.h
 # endif
 
@@ -421,7 +421,7 @@ extern void LoadSessionResources (struct display *d);
 extern void ReinitResources (void);
 
 /* in session.c */
-# ifdef USE_PAM
+# ifdef HAVE_PAM_OPEN_SESSION
 extern pam_handle_t **thepamhp(void);
 extern pam_handle_t *thepamh(void);
 # endif
diff --git a/greet.h b/greet.h
index 6b6689e..e5dbb01 100644
--- a/greet.h
+++ b/greet.h
@@ -85,7 +85,7 @@ struct dlfuncs {
 void (*_endpwent)(void);
 #endif
 char *(*_crypt)(CRYPT_ARGS);
-#ifdef USE_PAM
+#ifdef HAVE_PAM_OPEN_SESSION
 pam_handle_t **(*_thepamhp)(void);
 #endif
 };
@@ -169,7 +169,7 @@ extern  struct passwd   
*(*__xdm_getpwnam)(GETPWNAM_ARGS);
 extern  void(*__xdm_endpwent)(void);
 # endif
 extern char*(*__xdm_crypt)(CRYPT_ARGS);
-# ifdef USE_PAM
+# ifdef HAVE_PAM_OPEN_SESSION
 extern  pam_handle_t**(*__xdm_thepamhp)(void);
 # endif
 
@@ -211,7 +211,7 @@ extern  pam_handle_t**(*__xdm_thepamhp)(void);
 #  define  endpwent(*__xdm_endpwent)
 # endif
 # define   crypt   (*__xdm_crypt)
-# ifdef USE_PAM
+# ifdef HAVE_PAM_OPEN_SESSION
 #  define  thepamhp(*__xdm_thepamhp)
 # endif
 
diff --git a/greeter/Login.h b/greeter/Login.h
index 22529a5..01e79cb 100644
--- a/greeter/Login.h
+++ b/greeter/Login.h
@@ -155,7 +155,7 @@ from The Open Group.
 # include pwd.h
 # include limits.h
 
-# ifdef USE_PAM
+# ifdef HAVE_PAM_OPEN_SESSION
 #  define NAME_LEN PAM_MAX_RESP_SIZE
 #  define PASSWORD_LEN PAM_MAX_RESP_SIZE
 # endif
diff --git a/greeter/greet.c b/greeter/greet.c
index d8ebb41..8200417 100644
--- a/greeter/greet.c
+++ b/greeter/greet.c
@@ -130,7 +130,7 @@ struct passwd   *(*__xdm_getpwnam)(GETPWNAM_ARGS) = NULL;
 void   (*__xdm_endpwent)(void) = NULL;
 # endif
 char *(*__xdm_crypt)(CRYPT_ARGS) = NULL;
-# ifdef USE_PAM
+# ifdef HAVE_PAM_OPEN_SESSION
 pam_handle_t **(*__xdm_thepamhp)(void) = NULL;
 # endif
 
@@ -146,7 +146,7 @@ pam_handle_t **(*__xdm_thepamhp)(void) = NULL;
 extern Display *dpy;
 
 static int done, code;
-#ifndef USE_PAM
+#ifndef HAVE_PAM_OPEN_SESSION
 static charname[NAME_LEN], password[PASSWORD_LEN];
 #endif
 static Widget  toplevel;
@@ -154,7 +154,7 @@ static Widget   login;
 static XtAppContextcontext;
 static XtIntervalIdpingTimeout;
 
-#ifdef USE_PAM
+#ifdef HAVE_PAM_OPEN_SESSION
 static int pamconv(int num_msg,
 # ifndef sun
   const
@@ -200,7 +200,7 @@ GreetDone (
data-name, strlen (data-passwd));
 switch (status) {
 case NOTIFY_OK:
-#ifndef USE_PAM
+#ifndef HAVE_PAM_OPEN_SESSION
strncpy (name, data-name, sizeof(name));
name[sizeof(name)-1] = '\0';
strncpy (password, data-passwd, sizeof(password));
@@ -225,7 +225,7 @@ GreetDone (
done = 1;
break;
 }
-#ifndef USE_PAM
+#ifndef HAVE_PAM_OPEN_SESSION
 if (done) {
bzero (data-name, NAME_LEN);

Re: [PATCH app-xdm 2/9] config: upgrade the checking for PAM support

2010-11-22 Thread Alan Coopersmith
Gaetan Nadon wrote:
 + [Use PAM for authentication (default is autodected)]),

s/autodected/autodetected/

 -# ifdef USE_PAM
 +# ifdef HAVE_PAM_OPEN_SESSION

USE_PAM really does seem more descriptive in this case than
HAVE_PAM_OPEN_SESSION though, since it's the whole framework
we care about (and a build-time option to disable), not just
the presence of one function.

-- 
-Alan Coopersmith-alan.coopersm...@oracle.com
 Oracle Solaris Platform Engineering: X Window System

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel


[PATCH app-xdm 2/9] config: upgrade the checking for PAM support

2010-11-12 Thread Gaetan Nadon
Use AC_CHECK_FUNCS to get the consistent #define HAVE_xxx
Use auto rather than try for consistency with other modules.
Update help string to mention default value.
Unchanged: if configured --with-pam and -lpam is misisng,
abort the configuration.

Signed-off-by: Gaetan Nadon mems...@videotron.ca
---
 configure.ac |   20 ++--
 dm.h |4 ++--
 greet.h  |6 +++---
 greeter/Login.h  |2 +-
 greeter/greet.c  |   22 +++---
 greeter/verify.c |8 
 session.c|   22 +++---
 7 files changed, 42 insertions(+), 42 deletions(-)

diff --git a/configure.ac b/configure.ac
index e2e15f6..3e6bc01 100644
--- a/configure.ac
+++ b/configure.ac
@@ -119,17 +119,17 @@ AC_CHECK_DECL(key_setnet,
 #include rpc/key_prot.h
 ])
 
-# Check for PAM support
-use_pam_default=try
-AC_ARG_WITH(pam, AC_HELP_STRING([--with-pam],[Use PAM for authentication]),
-   [USE_PAM=$withval], [USE_PAM=$use_pam_default])
+# Check for pluggable authentication modules (PAM) support
+AC_ARG_WITH(pam, AS_HELP_STRING([--with-pam],
+   [Use PAM for authentication (default is autodected)]),
+   [USE_PAM=$withval], [USE_PAM=auto])
 if test x$USE_PAM != xno ; then
-   AC_SEARCH_LIBS(pam_open_session,[pam])
-   AC_CHECK_FUNC(pam_open_session, 
-   [AC_DEFINE(USE_PAM,1,[Use PAM for authentication])],
-   [if test x$USE_PAM != xtry ; then
-   AC_MSG_ERROR([PAM support requested, but 
pam_open_session not found.])
-fi])
+AC_SEARCH_LIBS([pam_open_session], [pam],
+   [AC_CHECK_FUNCS([pam_open_session])],
+   [AS_IF([test x$USE_PAM = xyes],
+   [AC_MSG_ERROR([PAM support requested, but pam_open_session not 
found.])]
+   )]
+)
 fi
 
 use_selinux_default=no
diff --git a/dm.h b/dm.h
index 6633248..7c67906 100644
--- a/dm.h
+++ b/dm.h
@@ -104,7 +104,7 @@ typedef union wait  waitType;
 #  endif
 # endif /* X_NOT_POSIX */
 
-# ifdef USE_PAM
+# ifdef HAVE_PAM_OPEN_SESSION
 #  include security/pam_appl.h
 # endif
 
@@ -421,7 +421,7 @@ extern void LoadSessionResources (struct display *d);
 extern void ReinitResources (void);
 
 /* in session.c */
-# ifdef USE_PAM
+# ifdef HAVE_PAM_OPEN_SESSION
 extern pam_handle_t **thepamhp(void);
 extern pam_handle_t *thepamh(void);
 # endif
diff --git a/greet.h b/greet.h
index 6b6689e..e5dbb01 100644
--- a/greet.h
+++ b/greet.h
@@ -85,7 +85,7 @@ struct dlfuncs {
 void (*_endpwent)(void);
 #endif
 char *(*_crypt)(CRYPT_ARGS);
-#ifdef USE_PAM
+#ifdef HAVE_PAM_OPEN_SESSION
 pam_handle_t **(*_thepamhp)(void);
 #endif
 };
@@ -169,7 +169,7 @@ extern  struct passwd   
*(*__xdm_getpwnam)(GETPWNAM_ARGS);
 extern  void(*__xdm_endpwent)(void);
 # endif
 extern char*(*__xdm_crypt)(CRYPT_ARGS);
-# ifdef USE_PAM
+# ifdef HAVE_PAM_OPEN_SESSION
 extern  pam_handle_t**(*__xdm_thepamhp)(void);
 # endif
 
@@ -211,7 +211,7 @@ extern  pam_handle_t**(*__xdm_thepamhp)(void);
 #  define  endpwent(*__xdm_endpwent)
 # endif
 # define   crypt   (*__xdm_crypt)
-# ifdef USE_PAM
+# ifdef HAVE_PAM_OPEN_SESSION
 #  define  thepamhp(*__xdm_thepamhp)
 # endif
 
diff --git a/greeter/Login.h b/greeter/Login.h
index 22529a5..01e79cb 100644
--- a/greeter/Login.h
+++ b/greeter/Login.h
@@ -155,7 +155,7 @@ from The Open Group.
 # include pwd.h
 # include limits.h
 
-# ifdef USE_PAM
+# ifdef HAVE_PAM_OPEN_SESSION
 #  define NAME_LEN PAM_MAX_RESP_SIZE
 #  define PASSWORD_LEN PAM_MAX_RESP_SIZE
 # endif
diff --git a/greeter/greet.c b/greeter/greet.c
index d8ebb41..8200417 100644
--- a/greeter/greet.c
+++ b/greeter/greet.c
@@ -130,7 +130,7 @@ struct passwd   *(*__xdm_getpwnam)(GETPWNAM_ARGS) = NULL;
 void   (*__xdm_endpwent)(void) = NULL;
 # endif
 char *(*__xdm_crypt)(CRYPT_ARGS) = NULL;
-# ifdef USE_PAM
+# ifdef HAVE_PAM_OPEN_SESSION
 pam_handle_t **(*__xdm_thepamhp)(void) = NULL;
 # endif
 
@@ -146,7 +146,7 @@ pam_handle_t **(*__xdm_thepamhp)(void) = NULL;
 extern Display *dpy;
 
 static int done, code;
-#ifndef USE_PAM
+#ifndef HAVE_PAM_OPEN_SESSION
 static charname[NAME_LEN], password[PASSWORD_LEN];
 #endif
 static Widget  toplevel;
@@ -154,7 +154,7 @@ static Widget   login;
 static XtAppContextcontext;
 static XtIntervalIdpingTimeout;
 
-#ifdef USE_PAM
+#ifdef HAVE_PAM_OPEN_SESSION
 static int pamconv(int num_msg,
 # ifndef sun
   const
@@ -200,7 +200,7 @@ GreetDone (
data-name, strlen (data-passwd));
 switch (status) {
 case NOTIFY_OK:
-#ifndef USE_PAM
+#ifndef HAVE_PAM_OPEN_SESSION
strncpy (name, data-name, sizeof(name));
name[sizeof(name)-1] = '\0';
strncpy (password, data-passwd, sizeof(password));
@@ -225,7 +225,7 @@ GreetDone (
done = 1;
break;
 }
-#ifndef USE_PAM
+#ifndef HAVE_PAM_OPEN_SESSION
 if (done) {
bzero (data-name, NAME_LEN);