This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU Inetutils ".

The branch, master has been updated
       via  139b77d07863a2620c63901681e6e20d2298a763 (commit)
      from  601105eae504371d873782596996c82899db897d (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.savannah.gnu.org/cgit/inetutils.git/commit/?id=139b77d07863a2620c63901681e6e20d2298a763


commit 139b77d07863a2620c63901681e6e20d2298a763
Author: Mats Erik Andersson <[email protected]>
Date:   Thu Mar 21 14:47:12 2013 +0100

    ftpd: Portability of PAM to Solaris.

diff --git a/ChangeLog b/ChangeLog
index 180b2de..dc3c639 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2013-03-21  Mats Erik Andersson  <[email protected]>
+
+       ftpd: Portability of PAM to Solaris.
+
+       * ftpd/pam.c: Include <unistd.h>.
+       (TTY_FORMAT): New macro.
+       (pam_user): New variable TTY_NAME.  Set PAM_TTY by calling
+       pam_set_item() with a value constructed from getpid().
+
 2013-03-19  Mats Erik Andersson  <[email protected]>
 
        ftpd: Support PAM beyond Linux-PAM.
diff --git a/ftpd/pam.c b/ftpd/pam.c
index 3a970a4..14ed2cb 100644
--- a/ftpd/pam.c
+++ b/ftpd/pam.c
@@ -22,6 +22,7 @@
 #include <stdio.h>
 #include <string.h>
 #include <stdlib.h>
+#include <unistd.h>
 #include <syslog.h>
 #include <unused-parameter.h>
 #include "extern.h"
@@ -255,11 +256,14 @@ pam_doit (struct credentials *pcred)
   return (error != PAM_SUCCESS);
 }
 
+#define TTY_FORMAT "/dev/ftp%d"
+
 /* Non-zero return means failure. */
 int
 pam_user (const char *username, struct credentials *pcred)
 {
   int error;
+  char tty_name[strlen (TTY_FORMAT) + strlen ("9999999")];
 
   if (pamh != NULL)
     {
@@ -272,12 +276,16 @@ pam_user (const char *username, struct credentials *pcred)
   free (pcred->message);
   pcred->message = NULL;
 
+  (void) snprintf (tty_name, sizeof (tty_name), TTY_FORMAT, (int) getpid());
+
   /* Arrange our creditive.  */
   PAM_conversation.appdata_ptr = (void *) pcred;
 
   error = pam_start ("ftp", pcred->name, &PAM_conversation, &pamh);
   if (error == PAM_SUCCESS)
     error = pam_set_item (pamh, PAM_RHOST, pcred->remotehost);
+  if (error == PAM_SUCCESS)
+    error = pam_set_item (pamh, PAM_TTY, tty_name);
   if (error != PAM_SUCCESS)
     {
       pam_end (pamh, error);

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog  |    9 +++++++++
 ftpd/pam.c |    8 ++++++++
 2 files changed, 17 insertions(+), 0 deletions(-)


hooks/post-receive
-- 
GNU Inetutils 

_______________________________________________
Commit-inetutils mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/commit-inetutils

Reply via email to